Presentation is loading. Please wait.

Presentation is loading. Please wait.

Learning By Doing // Tu01.java import ch.aplu.turtle.*; class Tu01 { Tu01() { Turtle john = new Turtle(); john.forward(20); john.right(90); john.forward(20);

Similar presentations


Presentation on theme: "Learning By Doing // Tu01.java import ch.aplu.turtle.*; class Tu01 { Tu01() { Turtle john = new Turtle(); john.forward(20); john.right(90); john.forward(20);"— Presentation transcript:

1 Learning By Doing // Tu01.java import ch.aplu.turtle.*; class Tu01 { Tu01() { Turtle john = new Turtle(); john.forward(20); john.right(90); john.forward(20); john.left(90); john.forward(20); john.right(90); john.forward(20); john.left(90); } public static void main(String[] args) { new Tu01(); } Sequenz sequenz

2 Learning By Doing // Tu02.java, while-Struktur import ch.aplu.turtle.*; class Tu02 { Tu02() { Turtle john = new Turtle(); int i = 0; while (i < 5) { john.forward(20); john.right(90); john.forward(20); john.left(90); i++; } public static void main(String[] args) { new Tu02(); } Iteration: while-Struktur while (Bedingung) { Anweisungen; } while

3 Learning By Doing // Tu03.java, do-while-Struktur import ch.aplu.turtle.*; class Tu03 { Tu03() { Turtle john = new Turtle(); int i = 0; do { john.forward(20); john.right(90); john.forward(20); john.left(90); i = i + 1; } while (i < 5); } public static void main(String[] args) { new Tu03(); } do-while-Struktur do { Anweisungen; } while (Bedingung) dowhile

4 Learning By Doing // Tu04.java, for - Struktur import ch.aplu.turtle.*; class Tu04 { Tu04() { Turtle john = new Turtle(); for (int i = 0; i < 5; i++) { john.forward(20); john.right(90); john.forward(20); john.left(90); } public static void main(String[] args) { new Tu04(); } for - Struktur for (Initialisierung; Bedingung; Wertänderung) { Anweisungen; } for

5 Learning By Doing Selektion: if – else - Struktur // Tu05.java, if - else - Struktur import ch.aplu.turtle.*; class Tu05 { Tu05() { Turtle john = new Turtle(); for (int i = 0; i < 100; i++) { john.forward(2); if (i < 50) john.left(3.6); else john.right(3.6); } public static void main(String[] args) { new Tu05(); } if (Bedingung) { Anweisungen; } else { Alternativanweisungen; } if

6 Learning By Doing switch - Struktur // Tu06.java, switch - Struktur import ch.aplu.turtle.*; class Tu06 { Tu06() { Turtle john = new Turtle(); for (int i = 0; i < 4; i++) { switch(i) { case 0: john.forward(20); break; case 1: john.forward(40); break; default: john.forward(100); break; } john.left(90); } public static void main(String[] args) { new Tu06(); } switch (ausdruck) { case wert1: Anweisungen; break; case wert2: Anweisungen; break; default: Anweisungen; break; } switch


Download ppt "Learning By Doing // Tu01.java import ch.aplu.turtle.*; class Tu01 { Tu01() { Turtle john = new Turtle(); john.forward(20); john.right(90); john.forward(20);"

Similar presentations


Ads by Google