Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the term for "catching" a return value

Tags:

terminology

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)?

like image 211
Todd R Avatar asked Nov 27 '22 06:11

Todd R


1 Answers

assign the return value to a variable?

like image 77
dr. evil Avatar answered Dec 10 '22 03:12

dr. evil