Ben Chuanlong Du's Blog

It is never too late to learn.

Operators in Different Programming Languages

Python Bash C/C++ Java Julia
and and -a && && &&
or or -o || || ||
not not ! ! ! !
bit and & & & & &
bit or | | | | |
bit not ~ ~ ~ ~ ~
bit xor ^ ^ ^ ^ ^
vector and
vector or
vector not
equals == -eq == == ==
not equal != -ne != != !=
greater than > -gt > > >
less than < -lt < < <
greater than or equal to >= -ge >= >= >=
less than or equal to <= -le <= <= <=
next loop continue continue continue continue continue
stop loop break break break break break
print echo printf/std::cout System.out.print, System.out.println print, println

Python supports 1 <= x < 3 which is equivalent to x >= 1 and x <3.

Comments