Most voted "operators" questions
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, including questions about syntax, in any language.
Learn more…330 questions
Sort by count of
-
11
votes2
answers299
viewsC operator precedence table
In C why y = (y=2 , y+3) returns 5 if the + has priority over = and the ,?
-
11
votes4
answers1541
viewsWhat is the difference between "++$variable" for "$variable++"?
What’s the difference between ++$variavel for $variavel++? I realize that when I execute a for with both forms, the results are the same. Example 1: for ($i = 0; $i < 3; $i++) echo $i; Prints: 0…
-
11
votes2
answers1506
viewsWhat is the difference between assigning and comparing string variables with function or with assignment and comparison operator?
I came across the following questions: What is the difference between expressions strcpy (s, t) e s = t ? What is the difference between expressions if (strcmp (s, t) < 0) e if (s < t) ? I…
-
11
votes2
answers14331
viewsHow does Groupby work on LINQ?
I’m having trouble understanding the operator Groupby on LINQ.
-
11
votes1
answer2858
viewsWhen should I use the "?" operator in C?
When I should use the ternary operator ? in C? #include <stdio.h> int main(void) { int valor, resultado; printf("\nValor: "); scanf("%d", &valor); resultado = valor < 10 ? 50 : 0;…
-
11
votes3
answers527
viewsPrecedence of operators
I have a question regarding the precedence of operators in Java. I have the following code: int x = 2; long y = 1 + x * 4 - ++x; Viewing the Precedence Table here. In my view the expression should…
-
11
votes4
answers160
viewsHow can I make a string code work with > or <?
Apparently I’m having problems with strings: public partial class Form1 : Form { private int _adicionar; private int _retirar; public Form1() { InitializeComponent(); } private void…
-
11
votes2
answers283
viewsWhat is the difference between using a comparison with >= or simply >?
Imagine the following scenario. int i = 2; if(i >= 2) { //.... } When we could just summarize to; int i = 2; if(i > 1) { //.... } My doubts with these two expressions are as follows:: When a…
-
11
votes4
answers455
viewsWhat is the difference between parseint() and operator + before a string?
I saw a colleague convert a string to integer using the syntax var a = +"10" but I always used the parseInt() and the line is usually like this var a = parseInt("10"). Why when placing the operator…
javascript string performance operators type-conversionasked 6 years, 1 month ago Hiago Souza 5,837 -
11
votes2
answers469
viewsWhat are the logical assignment operators ||=, &&= and ??= in Javascript?
I recently came across a code snippet like the one shown below: let alias = req.body.alias; alias = (alias ||= alias = 'generic'); I’ve never seen that operator before ||=, but after a brief search,…
javascript typescript characteristic-language operatorsasked 3 years, 11 months ago Cmte Cardeal 5,299 -
10
votes1
answer269
viewsDifficulty in Syntax
I would like you to explain this function, I do not understand this syntax: double sum_arithmetic(double x0, double r, int n) { return n == 0 ? 0 : x0 + sum_arithmetic(x0 + r, r, n-1); }…
-
10
votes3
answers1001
viewsUse OR operator in a PHP CASE
How to use the operator or in a control structure switch? Example switch ($options) { case 1 || case 2: echo "Valor de opção 1 e 2"; break; case 3: echo "Valor de opção 3"; break; }…
-
10
votes3
answers821
viewsWhat is the difference between "decimal. Divide" and the traditional "/" in C#?
decimal a = 10/5; Returns 2 decimal b = decimal.Divide(10,5); Returns 2
-
10
votes3
answers883
viewsHow to create operators in Python?
I was searching the internet about why Python doesn’t have the operator ++ and I saw someone saying that you can create this operator. How do you do this? How to create a Python operator?…
-
10
votes4
answers5082
viewsWhat does /= mean in Python?
Can anyone tell me what //= means in python? On line 8 of this code has the use of it. n = int(input("Digite um numero menor que 10: ")) aux, reverso = n, 0 while aux != 0: dig = aux%10 reverso =…
-
9
votes3
answers1348
viewsProblems with "or" in C++
I need to make an algorithm that gets 3 different numbers, and if it gets repeated numbers, it gives an error message. My program is all working properly, but when I put such a line to warn of the…
-
9
votes1
answer2493
viewsWhat are logical operators and how do bit-to-bit operations work in the C language?
What are logical operators NOT, AND, OR, XOR, in language C? Nor did I understand these operators: ~, &, |, ^, >>, << and the result in bits. I have the following example of code:…
-
9
votes2
answers238
viewsHow to create operators in C#?
How to create an operator in C#? For example, There are operators like: * multiplicacao / divisao % percentual The question is: How can I create my own operator? For example: 100 ~ 2 = 200.8 Where ~…
-
9
votes3
answers253
viewsIs there a "in" comparator operator in Javascript?
In Javascript there is a way to use in to check whether the value of a variable is contained in a list of values? A visual example: if (tipoDemissao in [1, 2, 5]){ valorDemissao = 525.20; }…
-
9
votes1
answer574
viewsWhat is Explicit in C++?
I came across the term explicit being used in a C code++. What is the use of this keyword?
-
9
votes1
answer855
views -
9
votes1
answer450
viewsWhat’s the comma for?
The comma is what? Just a language construct? An operator? Because it exists? This question is based on what was seen in How to return or extract more than one value from a function?. return base2,…
-
9
votes1
answer364
viewsIdentical sign "===" is only used in PHP? Why?
During my studies in C and Java, I always came across the sign "=" of attribution and the sign "==" being of equality. However, I am studying PHP now and came across the sign "===" of identical. My…
-
9
votes2
answers93
viewsMethod equivalent to Biginteger.and() in C#
I need to convert the java code below to C#: public static boolean verificaPermissao(BigInteger perm1, BigInteger perm) { if (perm1 == null || perm == null || (perm1.equals(BigInteger.ZERO) ||…
-
9
votes1
answer98
viewsWhat are the benefits of using the => operator in common methods that are unrelated to Lists or Lambda Expression?
I asked the following question: What value is checked in a condition operation with a variable value assignment? and the user @Maniero answered me, however, in the reply he used an operator and that…
-
9
votes3
answers189
viewsWhat happens in the expression "$a+++(+$a)"?
I was playing with PHP to see if I could find something that sounded strange with the syntax, inspiring me in the question What happens in 1...1 in PHP?. I just came across the code: $a = 0;…
-
9
votes2
answers993
viewsIs there the equivalent of Andalso and Orelse in C#?
In VB.NET there are two interesting operators: the AndAlso and the OrElse. When used, the logical expression is not evaluated in full immediately. See the following example: If (Not Usuario Is…
-
9
votes2
answers3537
viewsWhat is the function of the «??» operator (two questions) in PHP?
Analyzing a script PHP at a certain point I came across this line $valor = $_GET['id'] ?? 1; What is the interpretation of this code? What does it do?
-
9
votes1
answer89
viewsCan the & (bitwise and) Java operator be used for interfaces?
Snippet source code from interface Comparator. Somebody explain to me how this is treated Comparator<T> & Serializable? public static <T, U extends Comparable<? super U>>…
-
9
votes1
answer217
viewsHow will the null coalescence assignment operator work in PHP 7.4?
In version 7.4 of PHP was implemented the null coalescence assignment operator that promises to unify the behaviors of assignment and null coalescence operators, the latter being present since…
-
8
votes4
answers13140
viewsWhat is the difference between operators '==' and '==' in Javascript?
I would like to know the difference between the two operators who would be: (1): == (2): === If possible, I would also like to understand in this case the use of the opposite operators of them: (3):…
-
8
votes2
answers654
viewsPerformance of query LIKE in Mysql
Is there any way to increase the performance of a query with LIKE '%string%' in Mysql? I know that if the LIKE for 'string%', is faster. The problem is when the % is at the beginning of the string.…
-
8
votes2
answers2782
viewsIs there a difference between assigning value using '<-' or '=' in R?
In practical terms there seems to be no difference, but underneath the cloth as language processes there is some difference?
-
8
votes4
answers9085
viewsNOT operator in python
In java we have the operator not, we can use it like this: if (!metodo()) { //código } I’m just meeting python now, and I’m having a little trouble: I have a function that adds names to a list: def…
-
8
votes1
answer1179
views -
8
votes2
answers772
viewsHow does XOR work for two binaries with more than one digit?
I learned that the XOR operator works as OR Exclusive, that is, the end result is only 1 when only one of the operators is equal to 1. The truth table illustrates this well: My question is: how the…
-
8
votes3
answers1793
viewsHow to divide integers and get value with decimal part?
I am trying to divide the following values into c#: Double media = 0.0; int soma = 7; int cont = 2; media = soma / cont; Is returning 3.…
-
8
votes4
answers121
viewsShould I use two IF’s or an operator?
Best practice for checking two conditions? In the example I’m going to give, are not very long checks but what is the best practice and what is the difference? (It happened to me that I found myself…
-
8
votes3
answers10568
viewsWhat is the difference between using += and =+ in Python?
I’m having a hard time understanding the difference in logic between: x += n And: x =+ n
-
8
votes1
answer428
viewsWhat are the differences between the methods "equals()", "compareTo()", and even "=="?
I am aware that there are differences between comparing objects using equals(), compareTo() and even the operator ==, but in detail what are the differences between them and the care we should take…
-
8
votes1
answer132
viewsIn Rust how does ampersand and asterisk work?
I came from Java recently and I’m studying Rust. Language has a totally different paradigm than I was used to, but it caught my attention. For never having messed with C or C++, sometimes I find…
-
7
votes4
answers342
viewsWhat is the function of the " | " operator within the catch?
I read that || (OR) is for boolean operations and | (Bitwise Operation) for bit operations. What is your function within a catch with multiple exceptions, then? I mean, I know it eliminates…
-
7
votes1
answer236
viewsWhat is the usefulness of the ! operator in Java?
In a if(!aplicaDescontoDe(valor)); in which the method aplicaDescontDe is a boolean, how it works not understood? In that Example: public boolean aplicaDescontoDe(double porcentagem) {…
-
7
votes1
answer5408
views -
7
votes2
answers1283
viewsHow to convert ASCII to binary?
I’m trying to implement the conversion of a text to binary, I found one on the internet: static string ASCII_binary(string texto) { string converted = string.Empty; byte[] byteArray =…
-
7
votes3
answers1072
viewsWhat is and what is the function of . (dot) in POO?
A long time ago a teacher defined and explained the function of . in POO (Java class). With time I ended up forgetting, but I found it quite interesting, often we think is just a "point", however,…
-
7
votes1
answer392
viewsHow to use %<> % operator in R
What the operator means %<>% in r ? What is your difference from <- ? Under what circumstances can it be useful?
-
7
votes1
answer153
viewsWhat is an equal input parameter (allocation operator)?
I have a function defined as follows: public classeDeRetorno nomeDaFunção(string param1, string param2, string param3 = "") What does the param3 = ""? It equals the parameter to ""?…
-
7
votes2
answers586
views -
7
votes1
answer51
viewsOperator "and" for class assignment
Looking at some Github repositories I found this repository for generation of boletos with php and within the class Cedente I was struck by the use of the word and within the function construct in…