I stumble upon scala code like this:
var folderName: String = _
What does the = _
do? And is there a proper name for this language feature?
I stumble upon scala code like this:
var folderName: String = _
What does the = _
do? And is there a proper name for this language feature?
= _
is used to set the default value when initialising a variable.
var s: String = _
will set s
equal to null
.var i: Int = _
will set i
equal to 0
.