Questions tagged as 'if'

2
answers

Is it possible to perform an assignment and comparison in if clauses in Java?

Is it possible to assign and at the same time perform a comparison in an if clause in Java? For example: String linha = leitor.readLine(); String saida = ""; if (linha = leitor.readLine()) { saida += "\n"; } This does not seem to wor...
asked by 09.02.2014 / 22:46
2
answers

Portugol have ternary operator?

Does Portugol have any ternary operators? Example how it works in various languages: algumaVar = 10 > 0 ? 8 : 4 Just out of curiosity, it would be interesting if it had.     
asked by 16.02.2017 / 20:20
2
answers

Is there any way to break?

I wanted to know if there is any kind of 'break' in IF . My question is based on the example below. When the b() function returns false all subsequent comparisons are not performed. I thought the condition would compare all t...
asked by 21.09.2016 / 16:00
2
answers

Custom Search Tool Optimization

Now, I'm creating a search page that receives, via POST , information from a form containing several checkbox . See below that there are several sequences of results and one orange is marked as an example: WhenIclicksearch,theinfo...
asked by 27.02.2015 / 21:29
1
answer

How to combine two vectors and get all results from a given account with them

I'm trying to do a calculation and I need your help. First I make a normal distribution sequence with 420 numbers, then I make a sequence of numbers that I call mci with 42 numbers, then the next calculation has a if condition....
asked by 20.02.2016 / 03:20
5
answers

Use if inside foreach

I am trying to change the order in which the results appear within a loop using foreach. What I need is for numbers greater than five to appear first, followed by the rest of the numbers. So I tried something like this: $numeros = array(1, 2,...
asked by 09.05.2014 / 19:47
9
answers

Best practice for if

Which of the two code options performs better? I'm going to display a very simple example, there's usually more code inside if . A) string mensagem = "OI"; if(exibirAdeus) mensagem = "Adeus"; B) string mensagem = ""; if(exi...
asked by 03.02.2014 / 12:16
2
answers

Question and answer with if and else in Java

No matter what I answer, both "Yes" and "yes" only show ELSE . Where am I going wrong? package saudacao; import java.util.*; public class Saudacao { public static void main(String[] args) { System.out.println("Ola, bom dia, v...
asked by 25.05.2014 / 02:11
1
answer

How to execute only one if without entering the other in PHP

I have two if parallels and I need to get into one OR on another, not both. However, since I was within while with the first if , I could not put just else , having to make another if out of while . So ever...
asked by 13.11.2014 / 23:53
1
answer

How to use the toupper () function in char in C?

I'm creating a variable: char nome[20]; After this, I'm asking the user to enter a name: printf("Digite um nome : "); scanf("%20s",&nome); And I'm checking to see if the name is correct: if(strcmp(nome,"Maria") == 0){ pri...
asked by 28.03.2017 / 20:06