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
-
7
votes2
answers406
viewsWhy doesn’t Java add up the numbers in expression?
public class Teste { public static void main(String[] args) { int x = 0; int y = 1; int z = 2; System.out.print(x + y + z); } } This returns: 3 public class Teste { public static void main(String[]…
-
7
votes2
answers595
views"Operator" square brackets [] when creating the arrangement in C
Whenever I look for what the operator clasps [] makes, even in the tables that show all operators in C, appears that it serves to access an element of an arrangement. However, it is not always that…
-
7
votes1
answer521
viewsHow to correctly multiply the decimal type in C#?
I’m multiplying monetary values in C#, and for that I’m using the type decimal to store these values. I have noticed that in it there is a method called Multiply(), which receives two values and…
-
7
votes1
answer528
viewsWhat does "?" interrogation mean in accessing the properties of an object?
I have already used ternary operators to carry out this type of verification: route.params.userUpdated ? route.params.userUpdated : undefined; But I’ve never seen anything like it:…
-
6
votes4
answers41617
viewsSign of different Query
I have a problem presenting the Query. I got the field alvaraValidade which only receives Data fields. When I put nothing in that field, the field date is guarded as 0000-00-00. $sql = "Select *…
-
6
votes2
answers280
viewsPass two parameters to a function that accepts only one parameter
I’ve been making a code to generate a pdf from the framework Itext in Java. I came across the following situation, I needed to define a phrase as negrito and sublinhado. After searching Google, I…
-
6
votes1
answer270
views -
6
votes3
answers228
viewsI need an explanation about what a code I don’t understand does
I need to make a change to a code and I found this: <?=(((++$i % 2) == 1) ? 'class="colored"' : '')?> What that code does?
-
6
votes2
answers213
viewsDifference between ":" and "." in the methods of a Lua table
I came across two different statements that left me confused. obj = {} function obj.Create(name) end function obj:GoGoGo(name) end What is the difference between the declared function and the .…
-
6
votes3
answers4966
viewsWhat is the function of the operator "!" (exclamation)?
In this method: public boolean aplicaDescontoDe(double porcentagem) { if(porcentagem > 0.3) { return false; } else { this.valor -= valor * porcentagem; return true; } } What the operator means !…
-
6
votes2
answers148
viewsWhy doesn’t the pointer increase the value?
Here was to increase the value of the variable, but it does not work. #include <stdio.h> #include <stdlib.h> int main() { int *p, x = 10; p = &x; *p = (*p)++; printf("%d \n", *p);…
-
6
votes1
answer329
viewsHow are expressions evaluated in Java?
Reading some references it was possible to understand the basic, but not enough to decipher the following code: public class Expression { public static void main(String[] args) { int s = 5; s += s +…
-
6
votes1
answer584
viewsWhat does this "." point in Python mean?
What does that mean dot between the variable var and index? Example: var = ['João','Pedro','André','Alice'] var.index('André') Has any name?…
-
6
votes1
answer142
viewsIs it worth using binary operators to gain performance?
I have the following situations: if (1 & 1){} and if (1 == 1){} According to what I’ve learned, working with bitwise Operators causes a much better performance in the program, with this I came…
-
6
votes4
answers162
viewsWhat is the difference between the operator IN and ==?
I would like to know the difference between the operator IN and the == in Python?
-
6
votes1
answer745
viewsWhat is the usefulness of the exclamation (non null assertion Operator) in Typescript?
I recently discovered that in Typescript we can use the operator of non null assertion simply putting a ! where you want to check. When I saw it, I thought it was like in C#, that we have the ?,…
javascript typescript characteristic-language operators nullableasked 5 years, 8 months ago Francisco 7,472 -
6
votes1
answer165
viewsHow does the "+" operator work in Javascript?
Recently I had seen on the website of MDN Web Docs that it was possible to convert a String in a Number even in the example below: let n1 = "10"; console.log(typeof n1); //=> string ("10") The…
javascript characteristic-language typing operators type-conversionasked 4 years, 9 months ago felipe 61 -
6
votes1
answer63
viewsWhat are the differences between comparison operators in Erlang?
In Erlang, we have the following comparison operators: =:= =/= == /= It is said that the latter two can be used to make comparison between integers and floats, since the first two differentiate one…
-
5
votes3
answers937
viewsOperators, order, relevance, how it is read and priority
I came across the following question in a comment from the following Question One more question. The != operator is the same thing as < ? So I decided to come up with an answer by explaining it…
-
5
votes1
answer139
viewsPrecedence of operators with pointers
Having, for example, the following instructions: int i=10, j=20; int *pti, *ptj; pti = &i; ptj = &j; What is the meaning of j = pti == ptj; and of i = pti || ptj; ? Also, I read that the sum…
-
5
votes2
answers604
viewsTernary Operator, is_array, unexpected
Look at that. Follows the instruction $var = 123; echo "valor de var: " . is_array($var) ? implode("-",$var) : $var; There goes the following mistake: implode(): Invalid arguments passed. I hoped…
-
5
votes2
answers204
viewsWhat is the name of the ... operator used in PHP 5.6?
From the PHP 5.6 we now have the possibility to invoke or declare a function, stating that the arguments are infinite, through the .... Example: function add(... $arguments) { return…
-
5
votes2
answers135
viewsWhile with incomprehensible format
My knowledge in java is very basic, before that I came across a question to which I have not found answer. The code snippet below is used in some of my applications: File arquivo = new…
-
5
votes3
answers419
viewsHow to turn a bool into int?
I’m trying to do the following: if the guess value (_TextValPalite) is enabled then it will check that this number is not different from a minimum value and a maximum value. Ex: between 1 and 10 I…
-
5
votes1
answer716
viewsWhat is the difference between the "+" and "&" operators when concatenating strings?
In VB.NET, there are two operators I use in concatenating strings, the & and the + (I know there are more efficient methods for concatenating strings, but in this question, I pay attention only…
-
5
votes2
answers458
viewsDoubt in displacement of bits in C
My question is regarding the following excerpt from a code: #include <stdio.h> int main(void){ int teste = 0, x0 = 0, x1 = 0, x2; x2 = 1; teste = ((x0|x2) | (x1|x2) << 1); printf("Valor…
-
5
votes4
answers10900
viewsIs it possible to use the ternary operator under several conditions at the same time?
It is possible to use more than one condition at a time when using the ternary operator? <?php if($ativa == 0): echo "Médico(a) Desativado(a)"; elseif($ativa == 1): echo "Médico(a) Ativo(a)";…
-
5
votes3
answers300
viewsCode for reversing sequence of non-vowels ending with zero status
I’m implementing the function decodificar, which aims to call auxiliary functions to reverse all non-vowel sequences. For example, if the word is "cool monsters," it will go to "mortsnol segais".…
-
5
votes2
answers104
viewsIs there a performance benefit in replacing the operator "==" with the operator "=="?
I’m using the Jslint to check if the Javascript source code complies with the coding rules, and it is returning many suggestions to replace == (two signs of equals) with === (three signs of equals)…
-
5
votes2
answers107
viewsWhat is the function of this "=&" operator in PHP?
If I have the code below: $x = 1; $y = 1; if($x =& $y){ echo "ok"; }else{ echo "não"; } No matter what value I put in $x or $y, always falls in the echo "ok". Now if I don’t define one of the…
-
5
votes1
answer78
viewsType Object in PHP
I’m practicing some code in PHP when I come across this: <?php $a = (object) ["a" => "b"]; $b = (object) ["a" => "c"]; $y = $a <=> $b; echo $y; $v=[1,2,3] <=> [1,2,3]; echo $v;…
-
5
votes1
answer216
viewsWhat does the == operator mean in Kotlin?
What does the === Kotlin operator mean, and how to use it? I found this snippet of code in the documentation, but I was left with doubts. val boxedA: Int? = a val anotherBoxedA: Int? = a…
-
5
votes1
answer98
viewsCan Union and struct be considered operators?
One union or a struct can be considered operators? As well as return, goto and sizeof?…
-
5
votes1
answer138
viewsThe spread of Ecmascript ... arr is an operator?
I’ve seen articles referring to spread as "spread syntax" and as "spread operator" (for example here). I understand that an "operator" is "a function that takes arguments and returns a single…
javascript terminology characteristic-language operators ecmascriptasked 5 years, 6 months ago Thiago Krempser 1,878 -
5
votes1
answer109
viewsWhat does << in Ruby mean?
I’m studying a book of programming logic and wanted to know what it means << see what the book is applying to: This balcony to maintain a help variable with the actual size used an array is…
-
5
votes2
answers61
viewsWhat is the definition of delete in Javascript?
I came across an instruction that delete represents a type in Javascript. At least that’s what I understood. I’d like your help because I couldn’t find any references on the Internet. if…
javascript characteristic-language objects operators deleteasked 4 years, 6 months ago Willian Andrade 53 -
5
votes2
answers147
viewsIn Java because (250 >> 4) is more optimized than (250 / 16)
I’m taking a Java course and in a class the teacher said that this code: int xstart = Camera.x >> 4; int ystart = Camera.y >> 4; is more "fast or optimized" than this code: int xstart =…
-
5
votes1
answer60
viewsWhat is the relation of the "+" operator to the "valueOf()" method in Javascript?
I have a question about the operator +. In this answer on the operator, the following was said: The + can also play the role of a binary operator. In that case, operates on two values. In this…
javascript characteristic-language operators type-conversionasked 3 years, 5 months ago Cmte Cardeal 5,299 -
4
votes1
answer898
viewsHow do bit operators work?
I have the following code: volatile long Hex_To_int(long Hex , char bits) { long Hex_2_int; char byte; Hex_2_int = 0 ; for(byte = 0 ; byte < bits ; byte++) { if(Hex& (0x0001 << byte))…
-
4
votes5
answers267
viewsStore arithmetic operator in variable
I have the following code: $value1 = 10; $value2 = $value1 + 10; // $value2 == 20 I need the operator + is variable, that is, in my case I need it to be + or -. I tried the obvious but already sure…
-
4
votes2
answers212
viewsWhat is the # (fence) in the Lua language for?
I’m watching this one tutorial about creating a game and came across something I didn’t understand about the language Lua. There is an excerpt from the code where there is the following expression:…
-
4
votes1
answer2062
viewsExponentiation operator in C++
About a question recently asked and answered: there is some reason - historical or not - why C++ (as well as many other programming languages) does not include an operator for exponentiation? For…
-
4
votes1
answer107
viewsMeaning of the operator?
What is the function of by one !! in an if for example? know what ! by itself reverses the value of a boolean result, but tested the !! and nothing changed in the result, example: $teste = true;…
-
4
votes1
answer179
viewsProblem with boolean checks in Javascript
var a = '0'; if (!a) console.log('false'); if (a == false) console.log('false 2'); Why the false is not displayed but the false 2 is?
-
4
votes1
answer92
views -
4
votes2
answers67
viewsHow to reverse series of denied conditions without affecting logic?
Could someone explain to me why this happens? My apk only works right if I put denial and do something: public class Main2Activity extends AppCompatActivity { private EditText nome, teste, cpf;…
-
4
votes2
answers858
viewsOperator in java
I am learning Java and came across the need of the operator in. For example: I have a vector (v = {1,2,3,4,6}) and I want to see if 5 is in this vector (there is in this case). In python would be v…
-
4
votes2
answers1091
viewsOperation of the new operator
I wanted to understand basically what the logic behind the objects of the classes that use the operator new for example, I have the following program in D: import std.stdio; class Hello { public…
-
4
votes2
answers130
viewsHow to store an operator?
I wonder if you have any way to store an operator in a variable, for example a = < if 5 a 5: pass
-
4
votes1
answer197
views