I was training a new developer the other day and realized I don’t know the actual term for ‘catching’ a return value in a variable. For example, consider this pseudocoded method:
String updateString(newPart) { string += newPart; return string; }
Assume this is being called to simply update the string – the return value is not needed:
updateString('add this');
Now, assume we want to do something with the returned value. We want to change the call so that we can use the newly updated string. I found myself saying ‘catch the return value’, meaning I wanted to see:
String returnedString = updateString('add this');
So, if you were trying to ask someone to make this change, what terminology would you use? Is it different in different languages (since technically, you may be calling either a function or a method, depending on the language)?
assign the return value to a variable?