The prefix ! inverts a value's truth. Today you evaluate it, which forces the first decision about what counts as true or false in this language - its notion of truthiness.
Evaluate the prefix ! operator by defining which values are truthy.
Evaluating ! forces you to answer a question every language must: which values
are truthy? This language keeps it simple - false and null are falsy, and
everything else, including 0 and empty strings, is truthy. The ! operator is
where that rule first becomes visible.
So !true is false and !false is true. The interesting cases are !5 →
false (because 5 is truthy) and !!5 → true (invert twice). Your helper
should also treat null as non-truthy even though there is no null literal to
write yet - if and while will produce null values and lean on the exact
same definition to decide whether to take a branch or keep looping.
func evalBang(right Object) Object {switch right {case TRUE: return FALSEcase FALSE: return TRUEcase NULL: return TRUEdefault: return FALSE // any other value is truthy, so ! makes it false}}