What is the shortest way to reset BOOL in Objective-C?

I remember in Java you could just go

bool yesNo = YES; !yesNo; 

and it will be NO automatically. I tried this several times in Objective-C, but it does not seem to work. Is there any specific language for this in Objective-C?

+4
source share
1 answer

It works more or less the same way - you just need to remember that the result of the negation expression returns to the variable, for example:

 yesNo = !yesNo; 
+9
source

Source: https://habr.com/ru/post/1344856/


All Articles