官术网_书友最值得收藏!

Using the REPL

REPL is an acronym that stands for Read–Eval–Print Loop. An REPL is an interactive shell environment in which programs can be executed with immediate results given. The interactive shell environment can be invoked by running the kotlinc command without any arguments.

The Kotlin REPL can be started by running kotlinc in your terminal.

If the REPL is successfully started, a welcome message will be printed in your terminal followed by >>> on the next line, alerting us that the REPL is awaiting input. Now you can type in code within the terminal, as you would in any text editor, and get immediate feedback from the REPL. This is demonstrated in the following screenshot:

Kotlin REPL

In the preceding screenshot, the 1 and 2 integers are assigned to x and y, respectively. The sum of x and y is stored in a new z variable and the value held by z is printed to the display with the print() function.

主站蜘蛛池模板: 威海市| 蓬安县| 鄂伦春自治旗| 交口县| 沂水县| 喀喇沁旗| 南华县| 万源市| 南澳县| 新干县| 庆阳市| 昭觉县| 永兴县| 阳泉市| 斗六市| 巴南区| 枝江市| 太白县| 清水县| 汕尾市| 垣曲县| 托里县| 双牌县| 阿拉尔市| 玉龙| 大新县| 康乐县| 巴东县| 普格县| 德钦县| 秦皇岛市| 沁源县| 防城港市| 电白县| 马山县| 上思县| 林州市| 苍溪县| 清水县| 阿坝县| 汉源县|