Dabbling Around with Scala

Scala is a legendary language that allows both OO and functional programming. On top of that, it is compatible with Java and compiles to JVM bytecode. Hence, in theory, it could be used anywhere Java is used *cough cough* Android *cough cough*.

For a while, I have been meaning to try out Scala – and today I bit the bullet.

Closures are awesome. Here is a simple example which multiplies a list by 2 and prints the result:

Of course, this is a very trivial example of how closures can be used, but I find the syntax pretty cool nonetheless 😀

Here are some other features that I really like about Scala:

Just for kicks, I decided to build a simple regex matching program with character matching, “multiple”, and “or” functionality.

Leave a Reply

Your email address will not be published. Required fields are marked *