This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
new:ternary [2018/02/18 18:28] – korshun | new:ternary [2018/02/18 18:31] (current) – korshun | ||
---|---|---|---|
Line 3: | Line 3: | ||
[[ACC]] doesn' | [[ACC]] doesn' | ||
- | '' | + | '' |
- | If '' | + | If '' |
The only difference is that all arguments are evaluated before the function is called. This means that '' | The only difference is that all arguments are evaluated before the function is called. This means that '' | ||
+ | |||
+ | ===== Examples ===== | ||
+ | Without '' | ||
+ | < | ||
+ | int color = CR_RED; | ||
+ | if (PlayerTeam() == TEAM_BLUE) | ||
+ | color = CR_BLUE; | ||
+ | DrawSomething(color); | ||
+ | </ | ||
+ | |||
+ | With '' | ||
+ | < | ||
+ | DrawSomething(cond(PlayerTeam() == TEAM_BLUE, CR_BLUE, CR_RED)); | ||
+ | </ |