Questions tagged as 'operadores'

4
answers

Should I use two IF's or an operator?

What is the best practice for checking two conditions? In the example I am going to give, these are not very long checks, but what is the best practice and what is the difference? (it happened to me that I found myself having a if huge...
asked by 29.08.2018 / 12:33
1
answer

How to connect a bit to a number?

There are situations where we use numbers to load flags , meaning each bit, or set of bits, means something. Or we need to manipulate some data according to their bits, maybe it has to do with colors or something that bits individually end up h...
asked by 05.01.2017 / 11:54
4
answers

Difference between && and ||

I would like to know the difference between: window.RM = window.RM || {}; E: window.RM = window.RM && {}; Maybe the examples are not correct, but I would like to know the difference between the && and || o...
asked by 04.02.2018 / 01:54
1
answer

How useful the operator! in Java?

In if(!aplicaDescontoDe(valor)); in which the aplicaDescontDe method is a boolean, how does it work I did not understand? In this Example: public boolean aplicaDescontoDe(double porcentagem) { if(porcentagem >0.3) {...
asked by 01.08.2015 / 00:39
2
answers

Pass 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 like negrito and sublinhado . After searching Google, I found a user's su...
asked by 13.09.2014 / 15:20
3
answers

What is the function of the "!" (exclamation) operator? [duplicate]

In this method: public boolean aplicaDescontoDe(double porcentagem) { if(porcentagem > 0.3) { return false; } else { this.valor -= valor * porcentagem; return true; } } What does the ! operato...
asked by 18.01.2016 / 20:42
3
answers

Is there comparator operator "in" in JavaScript?

In JavaScript is there a way to use in to check if the value of a variable is contained in a list of values? A visual example: if (tipoDemissao in (1,2,5)){ valorDemissao = 525.20; }     
asked by 12.04.2016 / 14:25
3
answers

What happens in the expression "$ a +++ (++ $ a)"?

I was joking 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 ended up with the code: $a = 0; $a+++(++$a) The above "joke" returned 2...
asked by 05.08.2017 / 21:14
2
answers

What 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 , it always falls in echo "ok" . Now if I do not define one of the variables, it fal...
asked by 07.05.2018 / 01:18
2
answers

How to create operators in C #?

How to create a C # operator? 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 ~ would be my operator that...
asked by 29.09.2015 / 05:50