Acknowledgment: This text is a formatted version of a message posted to *Teaching on WorldMOO by Andy Bakun.
Eval, a command available to all programmers, is one of the most useful commands on the MOO. What it does is take it's arguments and 'evaluates' them, and returns the result. This has unending usefulness, from setting property values, to examining something in the database, to testing code fragments.
A short form of eval is the semicolon (;)
There are a few forms of the eval command, ;, ;;, and eval-d.
This just returns it's expression (the expression being 2) and is the same thing as a verb with one line of 'return 2;'
This is just like 'return 2+5;'
This is just like the code '2+5;' No return value is generated (0 is the default return value).
This is the code 'return 2+5;'
#-1:Input to EVAL, line 13: Type mismatch
This eval is just like 'return length(1);' and since length(1) is an invalid expression, and returns E_TYPE, the eval tracebacks.
=> E_TYPE (Type mismatch)
This is just like 'return length(1);' but run with the d bit unset, so length() doesn't cause it to traceback, it just returns the error value
;for x in (players()) if (x == #1353) return x; endif endfor
=> #1353 (ThwartedEfforts)
This is just like the verb code:
for x in (players())
if (x == #1353)