読者です 読者をやめる 読者になる 読者になる

by shigemk2

当面は技術的なことしか書かない

Scalaのブーリアンとかリテラルとか

Scala

scala> val t = true
t: Boolean = true

scala> val f = false
f: Boolean = false

scala> val a = 'A'
a: Char = A

scala> val b = '\u0041'
b: Char = A

scala> val c = '\101'
c: Char = A

scala> val s = "Hello"
s: String = Hello

scala> val es = "\"\\"
es: String = "\

scala> val es = "\"\/\"
<console>:1: error: invalid escape character
       val es = "\"\/\"
                    ^
<console>:1: error: unclosed string literal
       val es = "\"\/\"
                ^

scala> val es = "\"\'\"
<console>:1: error: unclosed string literal
       val es = "\"\'\"
                ^

scala> val es = "\"\'\\"
es: String = "'\

scala> val s = 'sSymbol'
<console>:1: error: unclosed character literal
       val s = 'sSymbol'
                       ^

scala> val s = 'sSymbol
s: Symbol = 'sSymbol

scala> s.name
res0: String = sSymbol