Skip to content

Instantly share code, notes, and snippets.

@nicol-ograve
Last active March 1, 2025 16:44
Show Gist options
  • Save nicol-ograve/5f838af54ca6ff49d62feff458e545ca to your computer and use it in GitHub Desktop.
Save nicol-ograve/5f838af54ca6ff49d62feff458e545ca to your computer and use it in GitHub Desktop.
// main: entry point dell'applicazione
void main() {
// variabile
var j = 0;
// costante: non può mai vambiare valore
final k = 5;
// costante il cui valore è noto a compile time
const x = 10;
j = 4;
// errore -> k = 4;
for (var i = 0; i < 10; i++) {
print('hello ${i + 1}');
}
// Tipi base
int numeroIntero = 42;
double numeroDecimale = 3.14;
bool valoreBooleano = true;
String testo = "Hello, Dart!";
// List = array
List<String> listaDiStringhe = ["Mela", "Banana", "Ciliegia"];
Map<String, int> mappa = {"Uno": 1, "Due": 2, "Tre": 3};
// dynamic = variabile senza tipo
dynamic variabileDinamica = "Posso cambiare tipo";
variabileDinamica = 123;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment