|
|
|
|
|
by duped
1170 days ago
|
|
> So values that are returned need not be primitive values like basic ints, floats, strings, etc? They can be complicated structure values also? It depends on the language and the rules about what structures can hold. For example, say your function doesn't return a value, but returns another function, and that function refers to variables in the first (this is called a "closure" or "lambda", the variable is "captured" or "closed over" by the returned function). In some languages this is OK and normal to do, in others there's no guarantee that the original variable exists anymore and the behavior is "undefined", and in others it is forbidden. The way that it is implemented also depends on the language. |
|