Presentasi sedang didownload. Silahkan tunggu

Presentasi sedang didownload. Silahkan tunggu

STRUCTURAL CONTROL continuation STATEMENT  SWITCH  WHILE  DO..WHILE.

Presentasi serupa


Presentasi berjudul: "STRUCTURAL CONTROL continuation STATEMENT  SWITCH  WHILE  DO..WHILE."— Transcript presentasi:

1 STRUCTURAL CONTROL continuation STATEMENT  SWITCH  WHILE  DO..WHILE

2

3  Used to test an expression to perform a number of different actions.  Usually used in place of a statement if... elseif... else.

4 Sintaks : Switch (ekspresi) { case (kondisi1): blok pernyataan1; break; case (kondisi2): blok pernyataan2; break;.... case (kondisi N): blok pernyataan N; break; deafault: blok pernyataan lainnya; break; }

5 Sintaks 2 : Switch (ekspresi) : case (kondisi1) : blok pernyataan1; break; case (kondisi2) : blok pernyataan2; break;.... case (kondisiN) : blok pernyataanN; break; default: blok pernyataan lainnya; break; endswitch;

6 statement switch <?php $Kode = date ("m"); switch($Kode) { case "01" : $Month = "January"; break; case "02" : $Month = "February"; break; case "03" : $Month = "March"; break; case "04" : $Month = "April"; break; case "05" : $Month = "May"; break; case "06" : $Month = "June"; break; case "07" : $Month = "July"; break; case "08" : $Month = "August"; break; case "09" : $Month = "September"; break; case "10" : $Month = "October"; break; case "11" : $Month = "November"; break; case "12" : $Month = "December"; break; } print ("Kode = $Kode "); print ("Nama Bulan = $Month "); ?>

7

8

9 Statement used to evaluate looping statement block for condition is true, and it will stop when the condition is false

10 Sintaks : While (kondisi) { blok pernyataan; } Atau While (kondisi) : blok pernyataan; endwhile

11  The condition is a boolean expression  Block statement is a list of statements to be repeated as long as conditions are met.  If the start condition is false, the statement block will never be done.

12 statement swile <?php print (" cara pertama : "); $x = 1; while ($x <=5) { print ("x = $x "); $x++; } print ( " cara kedua: "); $x = 1; while ($x<=5): print ("x = $x "); $x++; endwhile; ?>

13

14

15  In principle, the statement is similar to while working  In the do.. while, block statements certainly done one time and then do the test conditions.  If the condition is still true, the statement block reworked.  If the condition is false, the loop stops.

16 Sintaks : Do { blok pernyataan; } While (kondisi);

17  Condition is boolean  Block statements are statements that are repeated throughout the list true condition,  If the condition is false, then we are out of the statement and the statement after the while working.

18 statement dowhile <?php $hitung = 1; print ("Mulai... "); print ("Sekarang Hitung = $hitung "); do { print ("Indonesia Malaysia Cambodjia "); $hitung++; } while ($hitung <=5); print ("SELESAI. "); print ("Sekarang Hitung = $hitung "); ?>

19

20 The meeting is finished, you can download these materials at www.stmik-tasikmalaya.ac.id, download the menu, the course material ( filename = PHPMySQL4,Kamboja.) thank you see you at the next meeting


Download ppt "STRUCTURAL CONTROL continuation STATEMENT  SWITCH  WHILE  DO..WHILE."

Presentasi serupa


Iklan oleh Google