Assignment in Scala doesn't return a value, Unit is similar to void in C or C++.
try
var line = ""
while ({line = reader.readNext(); line != null}) { ... }
This works because the value of the last expression in a block is returned and in this case it is a Boolean which is required by the while