BAB 3: Struktur Kontrol
BAB 3: Struktur Kontrol
3.1 Percabangan (if-else)
If Statement Sederhana
void main() {
int umur = 18;
if (umur >= 17) {
print('Anda sudah bisa membuat KTP');
}
}If-Else Statement
void main() {
int nilai = 75;
if (nilai >= 60) {
print('Anda lulus!');
} else {
print('Anda perlu mengulang');
}
}If-Else If Statement
Nested If Statement
3.2 Switch Case
Switch Case Dasar
Switch Case dengan Expression
3.3 Perulangan (Loops)
For Loop
While Loop
Do-While Loop
3.4 Break dan Continue
Break Statement
Continue Statement
3.5 Praktek: Program Quiz Sederhana
Latihan Mandiri
Tips Penggunaan Struktur Kontrol
Last updated