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
-
143
votes10
answers34548
viewsWhat is the difference between the == and === Javascript operators?
I have the following Javascript code: var x = 0; if (x === false) { // não acessa } if (x == false) { // acessa } Why the expression with the operator == returns true and with the operator ===…
-
50
votes1
answer5366
viewsWhat is the meaning of the operator "?"
I was looking at some codes and I came across the operator ??: static int? GetNullableInt() { return null; } int y = x ?? -1; What is the difference between the first code and the second?…
-
47
votes3
answers12951
viewsJava += operator
I always thought the operator += functioned only as a shorter form for the traditional increment, for example: i += j; Instead of: i = i + j; But when performing the following experiment: int i = 3;…
-
46
votes2
answers13820
viewsDifferences between If and ternary operator ?:
There is a difference in performance between using an if and a ternary operator in C#? Utilise Resharper (Productivity tool for VS), he insists that the ternary operator is better but doesn’t…
-
42
votes3
answers5198
viewsDifference between the use of typeof and is
In C# when I need to check if a variable is of a certain type, I usually use the operator is: if(qualquerVariavel is int) Console.Write("A variável é int"); I know it is also possible to check the…
-
38
votes2
answers1727
viewsWhat is the function of the ~ (til) Javascript operator?
I tried to search for Google and SOEN, but I did not find any reference to the operator ~, I discovered that it exists because I was reading a book about Javascript and had an example using it, but…
-
37
votes4
answers37758
viewsWhat is the difference between "&&" and "||" and "and" and "or" in PHP? What to use?
I have that question, what’s the difference between && and || and between and and or? Which one should I use?
-
28
votes4
answers35105
viewsUse of ? and : in PHP
Can you explain to me what it’s for ? and : in PHP? For example in this case: public function url_format($post,$extra=FALSE) { $title = isset($post->post_title) ? $post->post_title :…
-
25
votes4
answers5615
viewsWhat is the difference in the use of the Equals method for the ==operator?
What is the difference in the use of the method Equals for the operator == in situations of comparison between (1) value types and (2) reference types?
-
25
votes2
answers1593
viewsWhat is the "?" operator?
I am seeing the functions that C# 6.0 brought, and an example of code appeared: C# 5.0 var vendor = new Company(); var location = default(string); if (vendor != null) if (vendor.ContactPerson !=…
-
25
votes4
answers4174
viewsWhat is the meaning of the operator ( * ) asterisk?
In C this operator is used in pointer type variables. However, in Python I don’t know which way, and why to use it. Therefore, what is the meaning of the operator (*) in the Python language?
-
25
votes4
answers4422
viewsWhat is the difference between & and &&operators?
I was making a simple code with a if two conditions. Everything worked normal and after I went to read, I realized I had written condicao & condicao2 instead of using &&. Even with this…
-
24
votes6
answers40933
viewsDoes ternary surgery exist in Python?
I often see several programming languages where a ternary operation is almost always identical. (x % 2 == 0) ? "par" : "impar" However, when I went to try to do this in Python, it was wrong: (x % 2…
-
23
votes2
answers2921
viewsWhat does the "=>" operator mean?
I was seeing some solutions in Javascript and in one case I saw this command line: return args.reduce((s, v) => s + v, 0);. But I don’t know what the operator means =>. What is his function?…
-
22
votes2
answers14617
viewsWhat is the difference and what are operators & and && e | and || in Java for?
I was analyzing some possibilities for the implementation of an algorithm and I went to look up this & and |, and I read some topics in English but it’s not 100% clear to me what it’s for and…
-
20
votes5
answers1879
viewsWhat is the difference between an explicit cast and the operator as?
Whenever I convert an object to a specific type, I use a cast explicit, for example: private void textBox1_Leave(object sender, EventArgs e) { TextBox textBoxTemp = (TextBox)sender;…
-
20
votes1
answer432
viewsWhat is the ~ (til) operator for in PHP?
What is the operator for ~ (til) in PHP? I’ve seen things like: echo ~PHP_INT_MAX Until then I thought it was to "reverse" a number to negative, or something like that, but with the tests I saw that…
-
20
votes5
answers2497
viewsWhat is the purpose of the "Spaceship Operator" <=> of PHP7?
I was just taking a look at the New Features of PHP 7 and I came across an operator, who I had never seen in any programming language. The PHP Handbook demonized him of Spaceship Operator. I’ll…
-
19
votes2
answers2430
viewsUsing && e || instead of "if" and "Else"
Lately I’ve seen some codes that use && and || to replace if and else , and even to do checks with less code. I’m using this technique quite smoothly so far. Follow an example code: const…
-
18
votes2
answers929
viewsOperator " | " in Java
I can’t find any material over the internet explaining the usefulness of the "|" operator in Java. I know there is "||" (or) used to test conditions. if(foo == 'a' || foo == 'b') But what about the…
-
18
votes2
answers2027
viewsWhat are operators for | & << >>?
I was analyzing a code and found some operators I don’t know: |, &, >> and <<. What is the functionality of these operators? bits = h1 << 18 | h2 << 12 | h3 << 6 |…
-
18
votes2
answers22927
viewsWhat is the meaning of the "&" (commercial) operator in the C language?
I am putting together a workbook in C and I am looking for a clear way to explain this operator to the reader, and I believe that this question will help the people who are starting. Take an…
-
18
votes2
answers1231
viewsCan the operators ==, ==, != and !== be considered as "fuzzy logic"?
Doubt is simple and just out of curiosity, from a mathematical point of view, we have something like ratio comparators (or Fuzzy logic): Example: Depiction described: x pode ser de 1 até 100 igual a…
operatorsasked 6 years, 8 months ago AnthraxisBR 4,361 -
17
votes2
answers218
viewsWhat is this !! operator in PHP?
I was analyzing a code in PHP and came across the following: $result = !! $row; return $result; What is this !! and what he does?
-
16
votes2
answers1480
viewsWhat is the function of operators <<, >> and >>> in Javascript
What is the function of mathematical operators <<, >> and >>> javascript? Examples: 0 or 1 >> 1 is 0 2 or 3 >> 1 is 1 4 or 5 >> 1 is 2 Same goes for negative…
-
16
votes4
answers930
viewsBehavior of different ways of comparison in Java
If for example I have the code below, I am comparing the reference of the objects in the case ex1 and ex2 and not the object itself, correct? Pessoa ex1 = new Pessoa(); Pessoa ex2 = new Pessoa();…
-
16
votes2
answers1760
viewsWhat is the difference between "!=" and "<>" in PHP? What to use?
What’s the difference between != and <>? Which one should I wear?
-
16
votes2
answers17517
viewsReal difference between point operator (.) and arrow operator (->) in C?
What is the real difference between the two operators. I know the operator (->) is used when the variable is a pointer, and that it is equivalent to (*ptr).membro. Well, if I declare a pointer of…
-
15
votes3
answers15299
viewsAvoiding "!= null" comparison in Java
I work with Java and for countless times I have to take a test object != null on the object before accessing it to avoid Nullpointerexception However, I think this practice ends up making the code…
-
15
votes2
answers17329
viewsWhat does "!" (exclamation) mean before a code snippet?
There are many basic things I do not know, for example how to read exactly this exclamation the way it is placed in the following section: if…
-
15
votes2
answers716
viewsWhat is the name of => operator in PHP used in arrays?
In PHP, when we declare a array directly, we have the operator =>. I know that in PHP we have the ->, that is Separator Object, but I had to give the name to => and could not explain. What…
-
15
votes2
answers1239
viewsWhat is the difference between *var++ and *var += 1?
I’m writing a feature with the signature: int increment(int *val). My intention is to receive an entire pointer, increase its value in 1 and return that value. The body of my function was as…
-
15
votes2
answers2129
viewsWhat does the "|=" operator mean in Python?
I was analyzing a code and came across the operator |=, would like to know what this means, and what is its practical application. Example: x |= y…
-
14
votes2
answers23232
views -
14
votes2
answers352
viewsWhat does the operator = mean in C#?
I have a function in C#, where I decrypt a string and need to convert into a function in SQL Server for technicians to be able to work with the decrypted value. There is a foreach, I don’t…
-
14
votes1
answer326
viewsWhat is the difference between >>= and >>>= in Java?
Reading a book about the Java language, I came across some operators I had never noticed before. They are: >>, <<, >>=, <<=, >>>, <<<, >>>= and…
-
14
votes1
answer920
viewsWhat’s the point of double exclamation before the method call on Kotlin?
I’m studying Kotlin. I realized that in converting to the type int, it is necessary to place the double exclamation (!!). Example: var input = readLine()!!.toInt(); Generally in other languages,…
-
14
votes4
answers1171
viewsWhat is the difference between -= and =-?
In java and other languages I’ve seen in some projects things like: saldo -= 100 and sometimes saldo =- 100 but I could never understand the difference between those two guys, if there’s any…
-
13
votes4
answers452
views& Together with PHP operators and functions
What is the meaning of the use of & together with operators and functions in PHP because I checked in some libraries (example) and functions this use (I am aware of the use together with…
-
13
votes3
answers1055
viewsIs there any performance gain when using ternary operator instead of a conditional operator?
What is the difference in performance using conditional operators and ternary operators? Is there any significant gain or the choice of use of ternary operators is unique to code simplification?…
-
13
votes2
answers241
views -
13
votes4
answers320
viewsWhat is .= in php?
What is .= in PHP? I’m wondering if it’s a concatenation or multiplication.
-
13
votes2
answers2784
viewsWhat is the argument limit of the IN operator in SQL Server?
In Oracle are 1000 arguments, which limit in SQL Server?
-
13
votes1
answer832
viewsWhat are statements and operators?
I usually access the MSDN often and I see a lot of these terms. What are statements and operators? What differentiates them?…
-
13
votes2
answers246
viewsWhat does "!!~" mean in Javascript?
I am studying Javascript and came across the following code: manageLag(selected) { if(!!~this.selections.indexOf(selected.url)) { selected.at += 5 return; } this.selections.push(selected.url) } I…
-
12
votes3
answers1869
viewsWhy (1 == true) is "true" and (2 == true) is "false"?
I was explaining to a friend of mine the difference between == and === in PHP and wanted to demonstrate this through the javascript console. I was going to demonstrate to him that in PHP, the…
-
12
votes3
answers8338
viewsWhat does %=mean?
I have a code that contains the situation below: id %= 1000 But I don’t know the function of that operator.
-
12
votes2
answers736
views -
12
votes1
answer560
viewsWhat is the operator '...' in Javascript?
I saw some uses of ... but I’m not sure what it does. Example: var a = [1, 2, 3]; var b = [4, 5, ...a]; What’s that operator’s name and how it works?…
-
12
votes4
answers2933
viewsDifference between operators && e ||
I’d like to know the difference between: window.RM = window.RM || {}; And: window.RM = window.RM && {}; Perhaps the examples are not correct, but I would like to know the difference between…