Don't forget to also checkout my second blog containing articles to all other related ICT topics!!

Friday, May 25, 2012

Playing with the Scala REPL

The first thing you want to verify is that Scala is installed correctly. During installation you get asked if Scala should be added to your path, make sure to do so. If you're working on windows like me, you can now open the command line. Press Start button and type cmd into the 'Search programs and files'. This will open a DOS shell. Next type scala and the REPL (Read Eval Print Loop) will start.
C:\Users\nxp10009>scala
Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_30).
Type in expressions to have them evaluated.
Type :help for more information.

scala> "Hello"
res0: java.lang.String = Hello

scala> "Hello".filter(_ != 'l')
res1: String = Heo

scala> 5
res2: Int = 5

No comments:

Post a Comment