Testing If Variable is Empty (nil)


/ Published in: Ruby
Save to your folder(s)

The code tests if session[:counter] exists. If you leave out the all important '?', it will fail with an error.


Copy this code and paste it in your HTML
  1. if session[:counter].nil?
  2. # code here
  3. end

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.