Quantcast
Channel: alvinalexander.com - field
Viewing all articles
Browse latest Browse all 31

Scala - Declaring a null var variable (field) before a try, catch, finally block

$
0
0

Sometimes when you're writing Scala code, you need to create a null variable (a var, not a val), such as when you need to declare a variable right before using it in a try, catch, finally block. I just ran into this when writing a Scala IMAP email client, where I needed to create two variables right before the try declaration, so I could reference the fields in the try block and also in the finally block.

read more


Viewing all articles
Browse latest Browse all 31

Trending Articles