Ternary,GCD,Prime number in three languages

java dev.to

Ternary A ternary operator is a short form of an if-else statement that takes three parts (three operands) — that’s why it’s called ternary. Syntax condition ? value_if_true : value_if_false; Find Largest of 3 Numbers Java int a = 10, b = 25, c = 15; int max = (a > b) ? (a > c ? a : c) : (b > c ? b : c); System.out.println("Largest = " + max); javascript let a = 10, b = 25, c = 15; let max = (a > b) ? (a > c ? a : c)

Read Full Tutorial open_in_new
arrow_back Back to Tutorials