For anyone who didn't know what if expressions look like in Erlang and had to look it up, apparently they use a series of "guard sequences" and the first one to be true determines the return value. If none of the sequences is true, it creates an error. There's no "else" keyword, so you have to use true as a substitute for it like this:
is_greater_than(X, Y) ->
if
X>Y ->
true;
true -> % works as an 'else' branch
false
end
As with the erlang example, I need a T test to get an else clause, although in this particular example, the result of the cond is nil if nothing matches anyway.
No, `test[true]` will be reassigned to the given function each time the condition evaluates to true.
Calling `test[true]()` will execute that given function.
See also: http://erlang.org/pipermail/erlang-questions/2009-January/04...