This file contains hidden or 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() { | |
| dynamic variable = 'Ich bin ein String'; | |
| print(variable); // Gibt den String aus: Ich bin ein String | |
| variable = 42; | |
| print(variable); // Jetzt ist 'variable' eine Zahl und gibt 42 aus | |
| variable = true; | |
| print(variable); // Und jetzt ist 'variable' ein Boolean und gibt true aus |
This file contains hidden or 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() { | |
| // Listen | |
| List x = [1, true, 2, 3.5, "vier", "Apfel"]; | |
| List<int> y = [1, 2, 3, 4, 5, 6, 7, 55, 4]; | |
| List z = x + y; | |
| print(z); | |
| // Maps | |
| Map preise = { |
This file contains hidden or 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() { | |
| // Listen | |
| List x = [1, true, 2, 4.5, "vier", "Apfel"]; | |
| print(x[5]); | |
| x[5] = "Banane"; | |
| print(x[5]); | |
| print(x[5].runtimeType); | |
| x.add("kiwi"); | |
| print(x[6]); |
This file contains hidden or 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() { | |
| //logische Operatoren: | |
| bool c = true; | |
| bool d = false; | |
| print(c && d); // logisches UND && | |
| print(c || d); // Logisches ODER && | |
| print(!(c || d)); // Negationsoperator ! | |
| } |
This file contains hidden or 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() { | |
| //Vergleichsoperatoren | |
| int a = 8; | |
| int b = 5; | |
| print(a == b); | |
| print(a != b); | |
| print(a > b); | |
| print(a < b); | |
| print(a >= b); |
This file contains hidden or 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() { | |
| //Arithmetische Operatoren | |
| int a = 8; | |
| int b = 5; | |
| a++; | |
| b++; | |
| print(a + b); | |
| print(a - b); | |
| print(a * b); | |
| print(a ~/ b); |
This file contains hidden or 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() { | |
| // Variablen deklarieren und initialisieren | |
| int ganzeZahl = 10; | |
| double kommazahl = 10.5; | |
| String text = "Hallo Dart!"; | |
| bool wahrheitswert = true; | |
| // Ermittlung des Datentyps zur Laufzeit und Ausgabe | |
| print('Der Datentyp von ganzeZahl ist: ${ganzeZahl.runtimeType}'); | |
| print('Der Datentyp von kommazahl ist: ${kommazahl.runtimeType}'); |
This file contains hidden or 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
| //Jetzt bist du dran! |
This file contains hidden or 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() { | |
| // Deklaration und Initialisierung einer int Variablen | |
| int anzahlDerBuecher = 120; | |
| print('Anzahl der Bücher: $anzahlDerBuecher'); | |
| // Deklaration und Initialisierung einer double Variablen | |
| double durchschnittsTemperatur = 22.5; | |
| print('Durchschnittstemperatur: $durchschnittsTemperatur Grad Celsius'); | |
| // Deklaration und Initialisierung einer String Variablen |
This file contains hidden or 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() { | |
| // Variablen deklarieren und initialisieren | |
| int zahl1 = 42; | |
| double kommaZahl = 3.14; | |
| String name = "Dart"; | |
| bool isLampOn = true; | |
| // Variablen ausgeben | |
| print("Die Zahl ist $zahl1"); | |
| print("Die Programmiersprache ist $name"); |
NewerOlder