@f0x It’s a joke on my part: The first ? is part of the method name (nil?); ruby doesn’t care whether you put a space between that and the following ?…: operator, which works like all other languages :blobcatgiggle:
@f0x The semantics are: Any variable assignment (statements of the form `<word> = <expression>`) results in the following steps (roughly):
1. Identify that variable in the enclosing scope(s). (`a`) 2. If it doesn’t exist, allocate it in the current scope, initialized to nil. (`a = nil`) 3. Evaluate the expression (`a`, which is currently nil). 4. Perform the assignment.
This results in some other interesting things, like
foo = “bar” if false
will init foo to nil, as before, but skip evaluating `"bar"` *and* skip assigning it. So depending on whether ‘foo’ was already in scope, this will either set it to nil, or leave it unchanged.
@f0x The semantics are: Any variable assignment (statements of the form `<word> = <expression>`) results in the following steps (roughly):
1. Identify that variable in the enclosing scope(s). (`a`)
2. If it doesn’t exist, allocate it in the current scope, initialized to nil. (`a = nil`)
3. Evaluate the expression (`a`, which is currently nil).
4. Perform the assignment.
This results in some other interesting things, like
foo = “bar” if false
will init foo to nil, as before, but skip evaluating `"bar"` *and* skip assigning it. So depending on whether ‘foo’ was already in scope, this will either set it to nil, or leave it unchanged.