2015年6月4日木曜日

開発環境

Learning Scala: Practical Functional Programming for the JVM (Jason Swartz (著)、O'Reilly Media)のPart Ⅰ. (Core Scala)、Chapter 1.(Getting Started with the Scalable Language)、Exercises 1.(No. 231)を解いてみる。

Exercises 1.(No. 231)

入出力結果(Terminal, REPL(Read, Eval, Print, Loop))

$ scala-2.11 
Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_25).
Type in expressions to have them evaluated.
Type :help for more information.

scala> println("Hello, World!")
Hello, World!

scala> "Hello, World!"
res1: String = Hello, World!

scala> 10
res2: Int = 10

scala> -10
res3: Int = -10

scala> 1.2
res4: Double = 1.2

scala> -1.2
res5: Double = -1.2

scala> 0o10
<console>:1: error: Invalid literal number
       0o10
       ^

scala> o10
<console>:8: error: not found: value o10
              o10
              ^

scala> 0x10
res7: Int = 16

scala> 'S'
res8: Char = S

scala> 's'
res9: Char = s

scala> :q
$

0 コメント:

コメントを投稿