Operator (computer programming): Difference between revisions

Content deleted Content added
Examples: more minor ones
No edit summary
Tags: repeating characters nonsense characters
Line 1:
{{refimprove|date=January 2012}}
 
[[Programming languages]] typically support a set of '''operators''': constructs which behave generally like functions, but which differ syntactically or semantically from usual functions. Common simple examples include arithmetic (addition with +, comparison with &gt;) and logical operations (such as AND or &amp;&amp;). More involved examples include assignmentassignme (usually = or :=), [[Field (computer science)|field]] access in a record or object (usually .), and the [[scope resolution operator]] (often <code>::</code>). Languages usually define a set of built-in operators, and in some cases allow user-defined operators.peryyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
 
==Syntax==
[[Syntax (programming languages)|Syntactically]] operators usually contrast to [[Function (computer science)|functions]]. In most languages, functions may be seen as a special form of prefix operator with fixed [[Order of operations|precedence]] level and associativity, often with compulsory [[Bracket#Parentheses .28 .29|parentheses]] e.g. <code>Func(a)</code> (or <code>(Func a)</code> in [[Lisp (programming language)|LISP]]). Most languages support programmer-defined functions, but cannot really claim to support programmer-defined operators, unless they have more than prefix notation and more than a single precedence level. Semantically operators can be seen as special form of function with different calling notation and a limited number of parameters (usually 1 or 2).