A function takes a string as argument, example fn("string"). i want to pass in different values depending on three of more condiitons, 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
})
This way 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?