Last active
February 8, 2023 18:10
-
-
Save ulisseshen/e8aa9fc117a1d1c64f04e949488012b4 to your computer and use it in GitHub Desktop.
[mobile_dev] Aula 2 - Dart listas, índices, concatenação e interpolação de String, for e for-in
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() { | |
List<int> numeros = pegarNumerosNoBackEnd(); | |
print(numeros[0]); | |
print(numeros[1]); | |
print(numeros[2]); | |
print(numeros[3]); | |
List<String> nomes = pegarNomesDePessoasNoBancoDeDados(); | |
print(nomes.length); | |
for(int indice=0; indice < nomes.length; indice++){ | |
print("$indice - ${nomes[indice]}"); | |
//print(indice.toString() + " - " + nomes[indice].toString()); | |
} | |
for (String nome in nomes) { | |
print(nome); | |
} | |
} | |
List<int> pegarNumerosNoBackEnd(){ | |
return [0, 1, 2, 3]; | |
} | |
List<String> pegarNomesDePessoasNoBancoDeDados(){ | |
return [ | |
"Ulisses", | |
"Gustavo", | |
"Natã", | |
"Criss", | |
"Ana Beatriz" | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
adicionei a linha 14 com a concatenação da string sem interpolação.