I have researched into this extensively, but cannot seem to find anything in its regard.
If I was to use an if statement as a validation and needed to write something along these lines:
if(split[lengthsplit + 1] == "=" && split[lengthsplit - 1] == "=")
Could I write the above as the following with the same result:
if(split[lengthsplit +- 1] == "=")
I cannot see the result of this and am wondering if in this case it would add a 1 and take it away or if it would try both scenarios first giving the ability to compress the validation down getting rid of the boolean operators to some degree.
If this is the case though perhaps I could use a split[lengthsplit+-] instead?
<< is the left shift operator. It is shifting the number 1 to the left 0 bits, which is equivalent to the number 1 .
In computer programming, ?: is a ternary operator that is part of the syntax for basic conditional expressions in several programming languages. It is commonly referred to as the conditional operator, inline if (iif), or ternary if.
Definition and Usage. The len() function returns the number of items in an object. When the object is a string, the len() function returns the number of characters in the string.
Could I write the above as the following with the same result
No you can't because this lengthsplit +- 1
translates to lengthsplit + (-1)
because the -
here is considered a unary operator (and unary operators have higher precedence than the binary +
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With