In Lua, you can do this:
foo = a and b or c and d or e
Which is equivalent to (at least I am pretty sure it is equivalent to):
local foo = nil
if a then
foo = b
elseif c then
foo = d
else
foo = e
end
Is there anything equivalent or similar to this in C++?
I guess this is what you want:
foo = a ? b : (c ? d : e );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With