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

  • 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.

主站蜘蛛池模板: 望江县| 汶川县| 泗洪县| 肥东县| 海阳市| 高淳县| 江源县| 轮台县| 兴仁县| 青冈县| 太仆寺旗| 西丰县| 邯郸县| 陆丰市| 巩义市| 错那县| 松阳县| 项城市| 读书| 中牟县| 禄劝| 宜阳县| 绵阳市| 长海县| 沾化县| 陇川县| 甘谷县| 建阳市| 高邮市| 平潭县| 宣恩县| 鹤壁市| 调兵山市| 克什克腾旗| 石台县| 淮南市| 龙门县| 浦北县| 兰溪市| 鄂伦春自治旗| 平顶山市|