-1

I came across a post with these "conditional operators" (im not sure) using <-, >-, <+, >+ I have never seen this before, and I am really wondering what it does.

>>> 1 <- 2
False
>>> 1 >- 2
True
>>> 1 <+ 2
True
>>> 1 >+ 2
False

Can please someone explain?

rrw
  • 671
  • 7
  • 18

2 Answers2

3

Behold the confusion that arises due to silly spacing.

Compilers and interpreters tend to ignore whitespaces while parsing/interpreting instructions. You don't see code the same way a compiler/interpreter does.

Is not 1 <- 2 the same as 1<-2? After all, what does a whitespace mean in arithmetic? Now since whitespace doesn't count for anything, let's add whitespaces, but a little more smartly:

1 < -2

There we go, all better now. Doesn't that make more sense? In future, try adding parenthesis to your statements, if noticing obvious patterns isn't your strong suit...

1 < (-2)

That doesn't change anything, but now it's a lot more readable.

Community
  • 1
  • 1
cs95
  • 379,657
  • 97
  • 704
  • 746
0

When you mention 1 <- 2 in your sample code, it is actually checking the condition 1 < -2 which returns False. Thus, of course, unfortunately you are not correct.
You must have been studying compound operators too much.

Vaibhav Bajaj
  • 1,934
  • 16
  • 29