Why use the ! operator thing when I could just flip the statement it's referencing? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why use the ! operator thing when I could just flip the statement it's referencing?

For example, If (!(age > 18)) Why wouldn't I just put (age < 18)

31st Mar 2019, 3:43 AM
Za Surpex
Za Surpex - avatar
2 Answers
+ 1
Then it wouldn't be included, right? So, then If (!(age > 18)) Is the same as If (age is =< 18) Right?
31st Mar 2019, 4:10 AM
Za Surpex
Za Surpex - avatar
+ 1
You're absolutely right, I mean <=. Still quite new to this, my apologies!
31st Mar 2019, 4:22 AM
Za Surpex
Za Surpex - avatar