What is this operator (?)? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is this operator (?)?

Plz tell me about the operator in this program. https://code.sololearn.com/cI7gVNrRhdZE/?ref=app

22nd Jul 2018, 3:22 AM
Mukul
Mukul - avatar
2 Answers
+ 5
Hi Mukul It is called a ternary operator It's basically the same as an if: (condition) ? True statements : false statements The difference between this and the if statement is that you use it to assign the result directly to a variable Hope it helps you
22nd Jul 2018, 3:35 AM
Guillem Padilla
Guillem Padilla - avatar
+ 2
Ok thank you Guillem Padilla
22nd Jul 2018, 3:36 AM
Mukul
Mukul - avatar