User:Ushkin N/Comparison of programming languages/Operators
Appearance
See Operator (computer programming).
Programming language | Nonalphanumeric operator symbols | Alphanumeric operator symbols | Prefix | Infix | Postfix | Precedence | Associativity | Overloading | Programmer-defined overloading | Programmer-defined operator symbols |
---|---|---|---|---|---|---|---|---|---|---|
ALGOL 68 | +* ** * / % %* %? - + < <= >= > = /= & -:= +:= *:= /:= %:= %*:= +=: :=: :/=:
(All operators have bold Alphanumeric equivalents, c.f. next column. Some have non ASCII equivalents, c.f. below.) ¬ +? ? ^ v ? ? ? ? ?? ?* ? ? ? ? ? ? ?:= ?:= ??:= ?*:= %?:= :?: |
not abs arg bin entier leng level odd repr round shorten i shl shr up down lwb upb lt le ge gt eq ne and or over mod elem minusab plusab timesab divab overab modab plusto is isnt | Yes | Yes | No | Yes (prefix operators always have priority 10) | Infix operators are left associative, prefix operators are right associative | Yes | Yes | Yes |
C | () [] -> . ! ~ ++ -- + - * & / % << >> < <= > <= == != ^ | && || ?: = += -= *= /= %= &= ^= |= <<= >>= | sizeof | Yes | Yes | Yes | Yes | Yes | Yes | No | No |
C++ (more) | sizeof typeid new delete throw decltype static_cast dynamic cast reinterpret_cast const_cast | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No | |
Java | new instanceof | Yes | Yes | Yes | Yes | Yes | Yes | No | No | |
Haskell | + - * / ^ ^^ ** == /= > < >= <= && || >>= >> $ $! . ++ !! : Many more in common libraries | The function's name must be put into backticks | Yes | Yes | No | Yes | Yes | Yes, using Type classes | Yes | |
Pascal | * / + - = < > <> <= >= := | not div mod and or in | Yes | Yes | No | Yes | Yes | Yes | No | No |
Seed7 | {} [] -> ** ! + - * / << >> & >< | = <> > >= < <= <& := +:= -:= *:= /:= <<:= >>:= &:= @:= | conv varConv parse conj div rem mdiv mod times mult in not and or digits lpad rpad lpad0 | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
Eiffel | [] + - * / // = /= | not and or implies "and then" "or else" | Yes | Yes | No | Yes | Yes | No | Yes | Yes |
Prolog | spy nospy not is mod | Yes | Yes | Yes | Yes | Yes | No | No | Yes | |
Lisp | Lisp defines all functions and symbols as operators.[1] Following the definition in this page, Lisp has no operators. | Yes (operators are regular functions) | No | No | No | No | No | No | Yes | |
Smalltalk | (yes - Up to two characters[2]) | Alphanumeric symbols need a colon after the keyword | No | Yes | Yes | No | No | Yes | Yes | Yes |
Perl | -> ++ -- ** ! ~ \ + - . =~ !~ * / % < > <= >= == != <=> ~~ & | ^ && || ' | print sort chmod chdir rand and or not xor lt gt le ge eq ne cmp x | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No |
- ^ "The Common Lisp HyperSpec".
- ^ Goldberg, Adele. "Smalltalk-80: The Language and its Implementation, p. 27, ISBN 0-201-11371-6" (PDF).