I would like to find the most effective and short way to do the following:
if current_value == "hide"
current_value = "show"
elsif current_value == "show"
current_value = "hide"
end
So, i would like to set the opposite to what the current situation is.
Thanks!
What about ternary?
current_value == "hide" ? current_value = "show" : current_value = "hide"
Maybe this would be better :
current_value = (current_value == "hide") ? "show" : "hide"
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments