In documentation of PHP, about switch says:
Note : Note that switch / case does loose comparison .
What is a loose comparison? And what's the difference between a loose and a rigid comparison?
Is it wrong to do this with switch ? I programmed it like that, is it wrong?
switch(estado){
case "AL":
case "BA":
case "CE":
case "MA":
case "PB":
case "PE":
case "PI":
case "RN":
case "SE":
//FAZ ALGO AQUI PARA TODOS OS CASES DO NORDES...
According to Java documentation : / p>
The Java compiler generally generates more efficient bytecode from switch statements that use String objects than from chained if-then-else statements.
Why does not this compile?
#include <stdio.h>
int main(void) {
int valor = 0;
scanf("%d", &valor);
switch (valor) {
case 0:
int variavel = 1;
printf("%d", variavel);
break;
default:...
In some situations you need to practice switch case for optimization and improvement of code. I have an application developed for Android using Java, which in the case is used in both situations. Below I have an example using return...
Viewing these comments about using switch is in doubt as to how it works even and why it is different from if when only buying by equality of a single variable against a sequence of values. p>
How is this compiled?
Should it...
Which of the two alternatives provides the best performance in Javascript: switch or if nested?
if {
...
} else {
if {
...
} else {
if {
...
} else {
...
}
}
}
or
switch(expression) {
case n:...
How to use the or operator in a control structure switch ?
Example
switch ($options) {
case 1 || case 2:
echo "Valor de opção 1 e 2";
break;
case 3:
echo "Valor de opção 3";
break;
}
...
After a search, I get the following result:
// O resultado desta linha é I ou II ou III;
echo $subsecao;
// O resultado desta linha é string;
echo gettype($subsecao);
// Faço um switch p...