what does if(x) and if(!x) mean..? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what does if(x) and if(!x) mean..?

14th Sep 2016, 4:12 PM
Ankit Ojha
Ankit Ojha - avatar
2 Answers
+ 5
if (condition) { //code to execute if condition is true } ! is the not operator. !x is true if x is false and vice-versa.
14th Sep 2016, 4:15 PM
Zen
Zen - avatar
- 1
if(x) {body} ----- in this if the condition is true the body is executed if(!x) {body } ----- in this i the condition is false then the body is executed
14th Sep 2016, 4:58 PM
Mukunth Venkatesh