Instantly share code, notes, and snippets.

@jmazzi /test.rb Secret
Created Dec 29, 2010

Embed
What would you like to do?
adapter_num = " "
@adapter_num = adapter_num ? adapter_num : 0
puts ":#{@adapter_num}:"
# Outputs : :
# Should be :0:
adapter_num = " "
@adapter_num = (adapter_num.nil? || adapter_num.empty?) ? adapter_num : 0
puts ":#{@adapter_num}:"
# Outputs :0:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment