What is "operators"

Operators are symbols that occur in almost every programming language and coding, for performing calculations and comparisons on data. Use the tag only when operators are relevant to the problem in any language, including syntax.

There are three basic types of operators: arithmetic (such as + for addition, * for multiplication, etc.), for comparison (such as == for equality, != for equality) and logical (as && for the Boolean AND operation and || for the boolean OR operation).

Use of this tag

Use this tag only when operators are relevant to the problem, including questions about syntax, in any language.

Examples

Some common operators in C family languages (which includes C, C++, Java, C#, Javascript, PHP, among others):

  • Operator of attribution =.
    Example:

    x = 10; // atribui valor 10 à variável x
    
  • Operator of numerical comparison >.
    Example:

    x > y; // a expressão x > y retorna true se o valor de x for maior que o de y
    
  • Operator of numerical comparison <.
    Example:

    x < y; // a expressão x < y retorna true se o valor de x for menor que o de y
    
  • Operator of logical negation !.
    Example:

    !x; // a expressão !x inverte o valor de x, considerando que x possui valor booleano;  
        // ou seja, retorna true se o valor de x false, e false se o valor de x for true