tagged [operators]
How to check if the string is empty?
How to check if the string is empty? Does Python have something like an empty string variable where you can do: Regardless, what's the most elegant way to check for empty string values? I find hard co...
- Modified
- 1 Nov at 13:1
^=, -= and += symbols in Python
^=, -= and += symbols in Python I am quite experienced with Python, but recently, when I was looking at the solutions for the [codility](https://www.codility.com/) sample tests I encountered the opera...
What is the !! (not not) operator in JavaScript?
What is the !! (not not) operator in JavaScript? I saw some code that seems to use an operator I don't recognize, in the form of two exclamation points, like so: `!!`. Can someone please tell me what ...
- Modified
- 13 Aug at 21:20
What does ?? operator means in C#?
What does ?? operator means in C#? > [What do two question marks together mean in C#?](https://stackoverflow.com/questions/446835/what-do-two-question-marks-together-mean-in-c) Hi, I was looking for...
Operator '??' cannot be applied to operands of type 'string' and 'System.DBNull'
Operator '??' cannot be applied to operands of type 'string' and 'System.DBNull' I have the following C# code: But it throws the following compilation error: > Operator `??` cannot be applied to opera...
What does "|=" mean? (pipe equal operator)
What does "|=" mean? (pipe equal operator) I tried searching using Google Search and Stack Overflow, but it didn't show up any results. I have seen this in opensource library code: What does "|=" ( `p...
What is the "??" operator for?
What is the "??" operator for? I was wondering about `??` signs in `C#` code. What is it for? And how can I use it? What about `int?`? Is it a nullable int? ### See also: > [?? Null Coalescing Operato...
- Modified
- 20 Jun at 09:12
What does the ^ operator do in Java?
What does the ^ operator do in Java? What function does the `^` (caret) operator serve in Java? When I try this: ...it gives me: > for n = 5, returns 0 for n = 4, returns 1 for n = 6, returns 3 ......
- Modified
- 28 Feb at 03:6
What does the colon (:) operator do?
What does the colon (:) operator do? Apparently a colon is used in multiple ways in Java. Would anyone mind explaining what it does? For instance here: ``` String cardString = ""; for (PlayingCard c :...
Detecting negative numbers
Detecting negative numbers I was wondering if there is any way to detect if a number is negative in PHP? I have the following code: I need to find out if `$profitloss` is negative and if it is, I need...
- Modified
- 26 Sep at 20:26
C# what does the == operator do in detail?
C# what does the == operator do in detail? in c# what does exactly happen in the background when you do a comparison with the "==" operator on two objects? does it just compare the addresses? or does ...
- Modified
- 8 Apr at 02:58
Handlebarsjs check if a string is equal to a value
Handlebarsjs check if a string is equal to a value Is it possible in Handlebars to check if a string is equal to another value without registering a helper? I can't seem to find anything relevant to t...
- Modified
- 25 Jun at 12:44
C# NOT (~) bit wise operator returns negative values
C# NOT (~) bit wise operator returns negative values Why does C#'s bitwise `NOT` operator return `(the_number*-1)-1`? How would I do this in C#?
- Modified
- 17 Jun at 12:32
What does question mark and dot operator ?. mean in C# 6.0?
What does question mark and dot operator ?. mean in C# 6.0? With C# 6.0 in the VS2015 preview we have a new operator, `?.`, which can be used like this: What exactly does it do?
C# bitwise shift on ushort (UInt16)
C# bitwise shift on ushort (UInt16) I need to perform a bitwise left shift on a 16-bit integer (ushort / UInt16), but the bitwise operators in C# seem to apply to int (32-bit) only. How can I use
- Modified
- 29 Sep at 07:32
If the left operand to the ?? operator is not null, does the right operand get evaluated?
If the left operand to the ?? operator is not null, does the right operand get evaluated? I'm looking at using the `??` operator (null-coalescing operator) in C#. But the [documentation](http://msdn.m...
Convert to binary and keep leading zeros
Convert to binary and keep leading zeros I'm trying to convert an integer to binary using the bin() function in Python. However, it always removes the leading zeros, which I actually need, such that t...
- Modified
- 31 May at 02:19
Is BitArray faster in C# for getting a bit value than a simple conjuction with bitwise shift?
Is BitArray faster in C# for getting a bit value than a simple conjuction with bitwise shift? 1). `var bitValue = (byteValue & (1
- Modified
- 11 Dec at 23:47
SQL Logic Operator Precedence: And and Or
SQL Logic Operator Precedence: And and Or Are the two statements below equivalent? and Is there some sort of truth table I could use to verify this?
- Modified
- 18 Feb at 14:42
Is it possible to create a new operator in c#?
Is it possible to create a new operator in c#? I know you can overload an existing operator. I want to know if it is possible to create a new operator. Here's my scenario. I want this: ``` var x = (y
Short circuiting statement evaluation -- is this guaranteed? [C#]
Short circuiting statement evaluation -- is this guaranteed? [C#] Quick question here about short-circuiting statements in C#. With an if statement like this: Is it guaranteed that evaluation will sto...
- Modified
- 22 Apr at 16:13
Is there a "null coalescing" operator in JavaScript?
Is there a "null coalescing" operator in JavaScript? Is there a null coalescing operator in Javascript? For example, in C#, I can do this: The best approximation I can figure out for Javascript is usi...
- Modified
- 22 Feb at 09:24
What does the operator "<<" mean in C#?
What does the operator "
Store an operator in a variable
Store an operator in a variable Is there a way to store an operator inside a variable? I want to do something like this (pseudo code): ``` void MyLoop(int start, int finish, operator op) { for(var i...