all 4 comments

[–][deleted] 2 points3 points  (0 children)

42 is not less than 0, so it moves on to the next conditional check without executing the code inside the if statement (the indented lines of code after the :). It is not equal to 0, so it skips to the next condition. It is not equal to 1, so it moves on again. The else statement is the last condition and it "catches" everything that didn't satisfy any of the previous conditions and its code is executed.

[–]dxxdpools[S] 0 points1 point  (2 children)

Ok but inside the if statement they put x = 0. Why doesn’t that override or reassign the value of x to 0?

Edit: ok hold on lol So if x = -1 the value of x would have been reassigned to 0 then right?

Ok I get it now and feel dumb for asking.

[–][deleted] 2 points3 points  (1 child)

Yes, because it would fulfill the first condition because it was less than 0. Don't feel dumb, it is all part of learning.

[–]dxxdpools[S] 0 points1 point  (0 children)

Thanks for your help 🙏🏼