Ternary Operator (टर्नरी ऑपरेटर):-
परिभाषा:
टर्नरी ऑपरेटर (जिसे conditional operator भी कहते हैं) वह ऑपरेटर है जो तीन ऑपरेंड पर काम करता है। इसका सिंटैक्स है:
condition ? value_if_true : value_if_false
उदाहरण (JavaScript में):
let marks = 45;
let result = (marks >= 33) ? "Pass" : "Fail";
console.log(result); // "Pass"
Ternary Operator
Definition:
The ternary operator (also called the conditional operator) is an operator that works on three operands. Its syntax is:
condition ? value_if_true : value_if_false
Example(JavaScript में):
let marks = 45;
let result = (marks >= 33) ? "Pass" : "Fail";
console.log(result); // "Pass"