A function takes a string as argument, example fn("string").
I want to pass different values depending on three of more conditions, and one approach which is slightly unreadable is:
fn(check_1 ? "yes" : check_2 ? "no" : "maybe")
I want to replace the argument with a block that returns a string. i am hoping i can do something like:
fn({|arg| if check_1
arg = "yes"
elsif check_2
arg = "no"
else
arg = "maybe"
end
})
I can have more conditions and would still be able to write all this as if this was in one line.
How do I do this in Ruby?