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

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.

主站蜘蛛池模板: 株洲县| 车险| 望谟县| 利川市| 泸西县| 麟游县| 吉隆县| 伊金霍洛旗| 垫江县| 油尖旺区| 淳安县| 雷州市| 武穴市| 滨州市| 盐源县| 博罗县| 哈巴河县| 鄂托克旗| 澳门| 海兴县| 五原县| 忻州市| 晋州市| 虎林市| 尉氏县| 开鲁县| 林周县| 克东县| 苍梧县| 耒阳市| 玛纳斯县| 汝州市| 镇雄县| 安义县| 乌兰县| 青岛市| 麦盖提县| 贵溪市| 璧山县| 江孜县| 工布江达县|