Skip to content

Instantly share code, notes, and snippets.

@M-Yankov
Created October 12, 2017 19:59
Show Gist options
  • Save M-Yankov/c108a22cdad124e58d69e88fe6b61c7c to your computer and use it in GitHub Desktop.
Save M-Yankov/c108a22cdad124e58d69e88fe6b61c7c to your computer and use it in GitHub Desktop.
It seems that the following syntax for nested ternary operators is the most readable (for me);
return
<First_Expression> ? "Value1" :
<Second_Expression> ? "Value2" :
<Third_Expression> ? "Value3":
"Value4"; // And so on....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment