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

REPL

Another tool that we will frequently use is REPL (Read Eval Print Loop). It is often used for quickly evaluating Scala expressions.

From sbt, we can enter REPL mode with the help of the sbt console command. Let's try some simple expressions.

Now, we'll look at how to evaluate expressions. Follow these steps to do so:

  1. Open the sbt tool.
  2. Open REPL by typing the following command:
    sbt console
  3. Type the following expressions and press Enter:
    • 2 + 2
    • "2" + 2
    • 2 + "2"
    • (1 to 8).sum
    • java.time.LocalTime.now()

Please note that we can have an interactive Scala playboard inside IDE by creating a special file type: a Scala Worksheet. It's useful, but is mainly for demonstration purposes.

主站蜘蛛池模板: 汉川市| 金秀| 凤山县| 迭部县| 宽甸| 内丘县| 当涂县| 明水县| 黄大仙区| 磐石市| 尚志市| 专栏| 巴楚县| 青神县| 姜堰市| 城固县| 周口市| 资阳市| 清河县| 赤壁市| 青神县| 延安市| 张家口市| 眉山市| 隆昌县| 广南县| 宁海县| 甘谷县| 沁水县| 抚州市| 白河县| 太原市| 迭部县| 镇原县| 西乌| 南郑县| 林芝县| 土默特左旗| 当阳市| 全州县| 浏阳市|