Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

ternary operator

// syntax:
condition ? console.log("true") : console.log("false");
// e.g:
let n = 15;
n % 2 === 0 ? console.log("even number") : console.log("odd number");
 
PREVIOUS NEXT
Tagged: #ternary #operator
ADD COMMENT
Topic
Name
2+8 =