For example suppose I have the following
var lastSecurity = ""
def allSecurities = for {
security <- lastTrade.keySet.toList
lastSecurity = security
} yield security
At the moment
lastSecurity = security
Seems to be creating a new variable in scope rather than modifying the variable declared in the first line of code.