operators_in_computer_programming

Operators in computer programming

Main Article: Operators

Return to Operators, Major programming topics, Programming topics, Programming languages, Software engineering topics, Software architecture, Software architecture topics, Awesome lists

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 >), and logical operations (such as AND or &&). More involved examples include assignment (usually = or :=), Field (computer science) | field access in a record or object (usually .), and the scope resolution operator (often ::). Languages usually define a set of built-in operators, and in some cases allow user-defined operators.

Snippet from Wikipedia: Operator (computer programming)

In computer programming, an operator is a programming language construct that provides functionality that may not be possible to define as a user-defined function (i.e. sizeof in C) or has syntax different than a function (i.e. infix addition as in a+b). Like other programming language concepts, operator has a generally accepted, although debatable meaning among practitioners while at the same time each language gives it specific meaning in that context, and therefore the meaning varies by language.

Some operators are represented with symbols – characters typically not allowed for a function identifier – to allow for presentation that is more familiar looking than typical function syntax. For example, a function that tests for greater-than could be named gt, but many languages provide an infix symbolic operator so that code looks more familiar. For example, this:

if gt(x, y) then return

Can be:

if x > y then return

Some languages allow a language-defined operator to be overridden with user-defined behavior and some allow for user-defined operator symbols.

Operators may also differ semantically from functions. For example, short-circuit Boolean operations evaluate later arguments only if earlier ones are not false.

External Sites


Cloud Monk is Retired (for now). Buddha with you. Copyright | © 2024 Losang Jinpa or Fair Use. Disclaimers. REPLACE with: navbar_footer


operators_in_computer_programming.txt · Last modified: 2025/02/01 06:37 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki