|REBOL 3 Docs||Guide||Concepts||Functions||Datatypes||Errors|
|TOC < Back Next >||Updated: 3-Aug-2010 Edit History|
Returns the first value, but also evaluates the second.
The also function lets you evaluate two expressions, but return the first, rather than the second. This function may seem a bit odd at first, but in many cases it can save you from needing another temporary variable.
Consider the case where you want to evaluate a block and return its result, but before returning the result, you want to change directories.
You could write:
result: do block change-dir old-dir return result
Or, you could write
return also do block change-dir old-dir
In fact, that's actually what happens in the in-dir function.
return also port/locals/buffer close port
If you close the port first, the buffer cannot be accessed.
|TOC < Back Next >||REBOL.com - WIP Wiki||Feedback Admin|