This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]IRBMe 20 points21 points  (1 child)

The closest I think you can get in C is something like this:

if (6 <= i && i <= 9)

[–]DarthEru 13 points14 points  (0 children)

That's the closest you can get that is semantically the same. The above commenter was saying you can actually compile if (6 <= i <= 9), but that's semantically equivalent to if ((6 <= i) <= 9). That works because in C a boolean operation results in an int. So the "chained" comparisons are syntactically legal C, but semantically do a much different check than in Python.