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

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -