18.07.2012, 08:22
TIL a little trick to extend the amount of statements executed in ternary statements.
Never thought about using the ',' operator this way. Group of statements must be enclosed in brackets. It's a neat little trick that might create some interesting constructs:
Never thought about using the ',' operator this way. Group of statements must be enclosed in brackets. It's a neat little trick that might create some interesting constructs:
pawn Code:
main () {
new bool:cond = true;
cond ? (print("T - First"), print("T - Second")) : (print("F - First"), print("F - Second"));
print("SWITCHING TRUTH");
cond = false;
cond ? (print("T - First"), print("T - Second")) : (print("F - First"), print("F - Second"));
}