ruby - How to return the value of the variable in the condition? -


code must return value of variable if value equal 42.
have 2 idea. variant choose?

# variant if foo == 42   return foo end  # variant b     if foo == 42   return 42 end 

if foo==42 foo end

this do.


Comments

Popular posts from this blog

PHP while loop dynamic rowspan -

android - How to read a column value in parse.com without accessing an object or a pointer -

timer - Java TimerTask cancel -