Skip to content
Discussion options

You must be logged in to vote

Ternary Conditional Expression

JEP JEP-21
Author Maxime Labelle
Status draft
Created 13-05-2025

Abstract

This JEP introduces a new expression to support an it-then-else ternary operation.

Motivation

Most languages do have a ternary operator that is akin to an if-then-else syntax as a single statement.
For instance, many languages do have the following syntax:

<condition> ? <true-result> : <false-result>

While JMESPath does not have a ternary operator, the closest approximation using an expression like ( x || y ) && z unfortunately suffers from a limitation that makes it not really a true ternary operator. Specifically, if both x and y are false, the expression still fa…

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
5 replies
@springcomp
Comment options

springcomp Jan 14, 2025
Maintainer Author

@gibson042
Comment options

@springcomp
Comment options

springcomp Jan 15, 2025
Maintainer Author

@gibson042
Comment options

@springcomp
Comment options

springcomp Jan 22, 2025
Maintainer Author

Comment options

You must be logged in to vote
4 replies
@springcomp
Comment options

springcomp Jan 15, 2025
Maintainer Author

@gibson042
Comment options

@springcomp
Comment options

springcomp May 15, 2025
Maintainer Author

@gibson042
Comment options

Answer selected by springcomp
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
JEP
Labels
syntax Will require grammar change jep-candidate JEP (Draft) available - please vote!
2 participants