+ 1

Can someone explain me this code?[SOLVED]

Why is the output 1 and not 0 as we have the NOT operator (!) ? https://code.sololearn.com/chOPmOT8me1G/?ref=app

15th Feb 2021, 9:18 PM
YourTimeIsComing
YourTimeIsComing - avatar
4 Answers
+ 2
Because "!b" is not modifying b You should write b=!b;
15th Feb 2021, 9:26 PM
Angelo
Angelo - avatar
+ 1
The command "!b;" just evaluates to false, but this result is not used by anything. It's like writing "2+2;", it evaluets to 4 but that 4 is not used So nothing changes
15th Feb 2021, 9:32 PM
Angelo
Angelo - avatar
+ 1
Angelo Ohh yeahh you're right I understood it now. Thank youu!
15th Feb 2021, 9:34 PM
YourTimeIsComing
YourTimeIsComing - avatar
0
Angelo true but then what changes with !b?
15th Feb 2021, 9:27 PM
YourTimeIsComing
YourTimeIsComing - avatar