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

  • Professional Scala
  • Mads Hartmann Ruslan Shevchenko
  • 119字
  • 2021-07-23 17:24:22

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.

主站蜘蛛池模板: 阜平县| 阜新市| 始兴县| 荥阳市| 德令哈市| 胶南市| 田林县| 大同县| 枝江市| 宁夏| 庆阳市| 上饶市| 芦山县| 吴忠市| 东乌珠穆沁旗| 桐柏县| 宝鸡市| 米林县| 扎兰屯市| 老河口市| 苍山县| 新安县| 福鼎市| 莱州市| 宁都县| 文登市| 广昌县| 金坛市| 射阳县| 甘南县| 盈江县| 金阳县| 汝州市| 三河市| 华蓥市| 永定县| 邢台县| 甘肃省| 比如县| 昌都县| 二连浩特市|