Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Operator (computer programming)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Operator features in programming languages == The following table shows the operator features in several programming languages: {| class="sortable wikitable" |- !Language !Symbolic operators !Alphanumeric operators ! {{verth|Prefix}} ! {{verth|Infix}} ! {{verth|Postfix}} ! {{verth|Precedence}} ! {{verth|Associativity}} ! {{verth|Overloading}} ! {{verth|User-defined<br/>overloading}} ! {{verth|User-defined<br/>symbols}} |- | [[ALGOL 68]] <small>each symbolic operator has an alphanumeric equivalent and some a non-[[ASCII]] equivalent</small> | {{code|1=+* ** * / % %* %Γ - + < <= >= > = /= & -:= +:= *:= /:= %:= %*:= +=: :=: :/=:}} '''non-ASCII:''' {{code|1=Β¬ +Γ β₯ β β β β Γ Γ· Γ·Γ Γ·* β‘ β€ β₯ β β§ β¨ Γ:= Γ·:= Γ·Γ:= Γ·*:= %Γ:= :β :}} | {{code|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 {{Not a typo|isnt}}}} | {{Yes}} | {{Yes}} | {{No}} | {{Yes}} <small>(prefix operators always have priority 10)</small> | Infix operators are left associative, prefix operators are right associative | {{Yes}} | {{Yes}} | {{Yes}} |- | [[APL (programming language)|APL]] | {{code|1=+ - Γ Γ· β β * β <nowiki>|</nowiki> ! β ~ β¨ β§ β± β² < β€ = β₯ > β . @ β‘ β’ β΄ , βͺ β³ β β ? β β β β½ β β β₯ β€ β β βΉ β β βͺ β© β· β· β β β / βΏ \ β Β¨ β£ & β¨ βΆ β β£ β’ β β€ βΈ βΊ βΈ}} | (requires β prefix) | {{Yes}} <small>(first-order functions only)</small> | {{Yes}} | {{Yes}} <small>(higher-order functions only)</small> | Higher-order functions precede first-order functions | Higher-order functions are left associative, first-order functions are right associative | {{Yes}} | {{Yes}} | {{Yes}} <small>(alphanumeric only)</small> |- |[[B (programming language)|B]] |{{code|1=() [] ! ~ ++ -- + - * & / % << >> < <= > >= == != ^ <nowiki>|</nowiki> [[?:]] = =+ =- =* =/ =% =& =^ =<nowiki>|</nowiki>}}<ref>{{Cite web |title=A TUTORIAL INTRODUCTION TO THE LANGUAGE B |url=https://www.bell-labs.com/usr/dmr/www/btut.html}}</ref> | |{{Yes}} |{{Yes}} |{{Yes}} |{{Yes}} |{{Yes}} |{{No}} |{{No}} |{{No}} |- | [[C (programming language)|C]] | {{code|1=() [] -> . ! ~ ++ -- + - * & / % << >> < <= > >= == != ^ <nowiki>|</nowiki> && <nowiki>||</nowiki> [[?:]] = += -= *= /= %= &= ^= |= <<= >>=}} | <code>[[sizeof]]</code> | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{No}} | {{No}} |- | [[C++]] | (same as C) | (same as C plus) <code>[[typeid]] [[new (C++)|new]] [[delete (C++)|delete]] [[Exception handling|throw]] [[decltype]] [[static_cast]] [[dynamic cast]] [[reinterpret_cast]] [[const_cast]]</code> | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{No}} |- | [[C sharp (programming language)|C#]] | (same as C plus) <code>[[?.]] ?[] [[Null coalescing operator|??]] <nowiki>??=</nowiki></code> | <code>[[sizeof]] nameof new stackalloc await [[Exception handling|throw]] checked unchecked is as delegate default true false</code> <br> '''[[LINQ]]:''' <code>from select where group...by group...by...into join...in...on...equals join...in...on...equals...into orderby orderby...descending</code> <br> '''[[Roslyn (compiler)|Roslyn]]-only:''' <code>__makeref __refvalue __reftype</code> | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{No}} |- | [[Java (programming language)|Java]] | (same as C) | <code>[[Java syntax#Instantiation|new]] [[Exception handling|throw]] [[instanceof]]</code> | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{No}} | {{No}} |- | [[Eiffel (programming language)|Eiffel]] | <code>[] + - * / // = /= </code> | <code>not and or implies "and then" "or else" </code> | {{Yes}} | {{Yes}} | {{No}} | {{Yes}} | {{Yes}} | {{No}} | {{Yes}} | {{Yes}} |- | [[Haskell]] |<code>+ - * / ^ ^^ ** == /= > < >= <= && <nowiki>||</nowiki> >>= >> $ $! . ++ !! :</code> <small>(and many more)</small> | (function name must be in backticks) | {{Yes}} | {{Yes}} | {{No}} | {{Yes}} | {{Yes}} | colspan="2" {{Yes}}, using [[Type class]]es | {{Yes}} |- | [[MultiValue|mvBasic Databasic/Unibasic]] |<code>+ - * / ^ ** : = ! & [] += -= := # < > <= >= <> >< =< #> => #< </code> |<code>AND OR NOT EQ NE LT GT LE GE MATCH ADDS() ANDS() CATS() DIVS() EQS() GES() GTS() IFS()</code> | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{No}} |- | [[Pascal (programming language)|Pascal]] | <code>* / + - = < > <> <= >= :=</code> | <code>[[Negation#Programming|not]] [[Integer division#Division of integers|div]] [[Modulo operation|mod]] [[Logical conjunction|and]] [[Logical disjunction|or]] in</code> | {{Yes}} | {{Yes}} | {{No}} | {{Yes}} | {{Yes}} | {{Yes}} | {{No}} | {{No}} |- | [[Perl]] | <code>-> ++ -- ** ! ~ \ + - . =~ !~ * / % < > <= >= == != <=> ~~ & <nowiki>|</nowiki> ^ && <nowiki>||</nowiki> ' '' {{Not a typo|// .. ... ?: {{=}} +{{=}} -{{=}} *{{=}} , {{=}}>}} </code> | <code>print sort chmod chdir rand and or not xor lt gt le ge eq ne cmp x </code> | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{No}} |- | [[PHP]] | <code>[] ** ++ -- ~ @!<ref>{{Cite web|url=https://php.net/manual/en/language.operators.errorcontrol.php|title=PHP: Error Control Operators - Manual|website=php.net}}</ref> * / % + - . << >> < <= > >= == != === !== <> [[Spaceship operator|<=>]] & ^ <nowiki>|</nowiki> && <nowiki>||</nowiki> [[Null coalescing operator|??]] [[?:]] = += -= *= **= /= .= %= &= <nowiki>|=</nowiki> ^= <<= >>= </code> | <code>clone new unset print echo isset [[instanceof]] [[Logical conjunction|and]] [[Logical disjunction|or]] [[xor]]</code> | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{No}} | {{No}} | {{No}} |- | [[PL/I]] | <code>( ) -> + - * / ** > Β¬> >= = Β¬= <= < Β¬< Β¬ <nowiki>&</nowiki> <nowiki>|</nowiki> <nowiki>||</nowiki></code> | | {{Yes}} | {{Yes}} | {{No}} | {{Yes}} | {{Yes}} | {{No}} | {{No}} | {{No}} |- | [[Prolog]] | <code>:- ?- ; , . =.. = \= < =< >= > == \== - + / *</code> | <code>spy nospy not is mod</code> | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{No}} | {{No}} | {{Yes}} |- | [[Raku (programming language)|Raku]] | <code>++ -- ** ! ~ ~~ * / + - . < > <= >= == != <=> & <nowiki>|</nowiki> ^ && <nowiki>||</nowiki> //</code> <ref>{{Cite web|url=https://docs.perl6.org/language/operators|title=Operators|website=docs.perl6.org}}</ref> | <code>print sort chmod chdir rand and or not xor lt gt le ge eq ne leg cmp x xx</code> | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}}<ref>{{Cite web|url=https://docs.perl6.org/language/functions#Defining_Operators|title=Functions|website=docs.perl6.org}}</ref> |- | [[Seed7]] | <code>{} [] -> ** ! + - * / << >> & >< <nowiki>|</nowiki> = <> > >= < <= <& := +:= -:= *:= /:= <<:= >>:= &:= @:=</code> | <code>conv varConv parse [[Complex conjugate|conj]] [[Integer division#Division of integers|div]] [[Remainder|rem]] [[Modulo operation|mdiv mod]] times mult in [[Negation#Programming|not]] [[Logical conjunction|and]] [[Logical disjunction|or]] digits lpad rpad lpad0</code> | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} |- | [[Smalltalk]] | (up to two characters<ref name="BinaryMessages">{{cite web|first=Adele|last=Goldberg|url=http://stephane.ducasse.free.fr/FreeBooks/BlueBook/Bluebook.pdf|title=Smalltalk-80: The Language and its Implementation, p. 27, ISBN 0-201-11371-6}}</ref>) | (alphanumeric symbols need a colon suffix) | {{No}} | {{Yes}} | {{Yes}} | {{No}} | {{No}} | {{Yes}} | {{Yes}} | {{Yes}} |- | [[Swift (programming language)|Swift]] | (any Unicode symbol string except) <code>.</code> (including) <code>! ~ + - * / % =+ =- =* =/ =% &+ &- &* =&+ =&- =&* && <nowiki>||</nowiki> << >> & <nowiki>|</nowiki> ^ == != < <= > >= ?? ... ..< </code> | <code>is as as?</code> | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} <small>(defined as partial order in precedence groups)</small> | {{Yes}} <small>(defined as part of precedence groups)</small> | {{Yes}} | {{Yes}} | {{Yes}} |- | [[Visual Basic .NET]] | rowspan="2" | <code>() . ! ?() ?. ?! + - * / \ & << >> < <= > >= ^ <> = += -= *= /= \= &= ^= <<= >>=</code> |<code>New Await Mod Like Is IsNot Not And AndAlso Or OrElse Xor If(...,...) If(...,...,...) GetXmlNamespace(...) GetType(...) NameOf(...) TypeOf...Is TypeOf...IsNot DirectCast(...,...) TryCast(...,...) </code> <br> '''[[LINQ]]:''' <code>From Aggregate...Into Select Distinct Where {{nowrap|<Order By>...[Ascending<nowiki>|</nowiki>Descending]}} Take {{nowrap|<Take While>}} Skip {{nowrap|<Skip While>}} Let Group...By...Into Join...On <Group Join...On...Into></code> | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{Yes}} | {{No}} |- |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)