What does nil mean?


#1

..... What does 'nil' mean?


#2

nil is the counterpart of something. In Ruby, something, meaning anything except false and nil is truthy.

nil is the response of the interpreter when there is no return value from a method. Consider some Ruby built-ins, such as puts and print. Neither of these have return values.

x = puts "No return value"
puts x

Output

No return value
nil

Notice how the console adds its own closing response, nil.