開発環境
- OS X Yosemite - Apple (OS)
- Emacs (Text Editor)
- Scala (プログラミング言語)
Learning Scala: Practical Functional Programming for the JVM (Jason Swartz (著)、O'Reilly Media)のPart Ⅰ. (Core Scala)、Chapter 2.(Working with Data: Literals, Values, Variables, and Types)、Exercises 1, 2.(No. 693)を解いてみる。
その他参考書籍
Exercises 1, 2.(No. 693)
入出力結果(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> val x = 20 // Int x: Int = 20 scala> val f1 = x * 9 // Int f1: Int = 180 scala> val f2 = f1 / 5 // Int f2: Int = 36 scala> val f3 = f2 + 32 // Int f3: Int = 68 scala> val y = 21 // Int y: Int = 21 scala> val f4 = y * 9 // Int f4: Int = 189 scala> val f5 = f4 / 5 // Int f5: Int = 37 scala> val f6 = f5 + 32 // Int f6: Int = 69 scala> val z = 20 // Int z: Int = 20 scala> val f7 = z * 9 // Int f7: Int = 180 scala> val f8 = f7 / 5.0 // Double f8: Double = 36.0 scala> val f9 = f8 + 32 // Double f9: Double = 68.0 scala> :q $
0 コメント:
コメントを投稿