Timeline for Javascript Ternary Operator vs. ||
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 4, 2013 at 14:06 | comment | added | ruffin | C#'s version on MSDN | |
| Jun 9, 2011 at 21:28 | comment | added | Lie Ryan | @Steve314: Python does have something you wanted: a separate else operator [false-part, true-part] with a separate if operator [..][bool(condition)] combined into [false-part, true-part][bool(condition)]. If you want lazy behavior, you can simply lambda the true- and false-part. | |
| Jun 8, 2011 at 21:56 | comment | added | user8709 | Another related operator is the Icon operator spelled IIRC "else". This recognises a special "fail" result from the first argument, and uses the second argument in that case as an alternative. I kinda wish Pythons "x if y else z" were implemented using two separate operators - an "if" binary assertion operator and an Icon-like "else" operator - with those two operators being usable independently. However, Icon didn't support that style, instead doing something bizarre with relative operators. | |
| Jun 8, 2011 at 20:35 | history | answered | Malfist | CC BY-SA 3.0 |