handle val like def
Update Scala example code.

This commit changes the example to use a wider variety of Scala
syntax. It also fixes a small bug with semicolons.