Last active
February 10, 2023 13:03
-
-
Save ulisseshen/f465474f077558b057c3ae15eff86ad5 to your computer and use it in GitHub Desktop.
[mobile_dev] Aula 4 - Dart operadors lógicos, relacionais e matemático - menor igual, negação, ou
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
for (int i = -2; i < 5; i++) { | |
if(i > 3){ | |
print("indice maior que 3"); | |
} | |
if(i <= 3){ | |
print("indice menor que 3"); | |
} | |
if(i != 3){ | |
print("indice diferente de 3"); | |
} | |
print(i); | |
} | |
print("Operações básicas math"); | |
print(1 + 5); | |
print(12/2); | |
print((3 * 4)/2); | |
print(20 - 14); | |
int dia = 10; | |
//operador lógico 'ou' | |
//true = se um dos valores são verdadeiros | |
//falso = quando todos os valores forem falsos | |
bool ehFeriado = (dia == 21) || (dia == 22) || (dia == 3); | |
// false = false || false || false | |
print("É feriado: $ehFeriado"); | |
bool ehAniversario = (dia == 3) || (dia == 10) || (dia == 12); | |
// ??? = false || true | |
print("É dia de aniversário: $ehAniversario"); | |
// Operador Lógico de Negação >> ! | |
// true = !false | |
// false = !true | |
bool notFeriado = !ehFeriado; | |
bool notAniversario = !ehAniversario; | |
print("Negar feriado: $notFeriado"); | |
print("Negar aniversário: $notAniversario"); | |
print("Negar feriado: ${!ehFeriado}"); | |
print("Negar aniversário: ${!ehAniversario}"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment