New course! Every coder should learn Generative AI!
Try a free lesson0
what does if(x) and if(!x) mean..?
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.
- 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