When nothing isn't

I would dispute the notion that NULL or \0 are uninteresting in C. But that's
not the question.

The Ruby language defines the value of an unset hash member as nil.

my_hash[:bogus_key] == nil => true

Further, Ruby defines the behavior of nil in a conditional as evaluating to
false, e.g.:

if nil
  puts 'it is nil'
  puts 'it has a value'

The session key deal is typically done as:

login_id = session[:user] || 0

Where the || conditional assignment provides some sensible default.


Wes Gamble-2 wrote: