@jroid8 to Programmer [email protected] • 10 months agoknow the features of your languageimagemessage-square145arrow-up1646arrow-down123
arrow-up1623arrow-down1imageknow the features of your language@jroid8 to Programmer [email protected] • 10 months agomessage-square145
minus-square@[email protected]linkfedilink3•edit-210 months agoYou don’t need the and right? Can’t it just be return a or b This doesn’t work if a is falsy non-null actually
minus-square@[email protected]linkfedilink1•10 months agoit’s just return a and b or c is the closest Lua has to a ternary operator, but yes, for the above you could shorten it to return a or b (“or returns the first argument if true, otherwise second argument is returned”)
You don’t need the and right? Can’t it just be
return a or b
This doesn’t work if a is falsy non-null actually
it’s just
return a and b or c
is the closest Lua has to a ternary operator, but yes, for the above you could shorten it toreturn a or b
(“or
returns the first argument if true, otherwise second argument is returned”)