Skip to content

Is ternary operator meant to use lazy evaluation? #797

Answered by antonmedv
mdmcconnell asked this question in Q&A
Discussion options

You must be logged in to vote

Yes! Ternary operator designed to be short circuiting.

If you need to run both expressions, assign the to variables. And use ternary operator on them.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by antonmedv
Comment options

You must be logged in to vote
3 replies
@mdmcconnell
Comment options

@antonmedv
Comment options

@mdmcconnell
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants