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

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.

主站蜘蛛池模板: 宝丰县| 临澧县| 昭觉县| 界首市| 秦皇岛市| 平潭县| 鄢陵县| 瑞昌市| 娄底市| 邓州市| 赤峰市| 门头沟区| 青海省| 白朗县| 绥江县| 巍山| 阿瓦提县| 石阡县| 徐州市| 镇雄县| 高唐县| 乐陵市| 南召县| 顺平县| 白朗县| 杭锦后旗| 英吉沙县| 商南县| 新化县| 化德县| 重庆市| 宿迁市| 佛山市| 丰原市| 锦屏县| 基隆市| 东源县| 延长县| 乌审旗| 延寿县| 双峰县|