Monday, August 20, 2007

Pengulangan dengan While

Pengulangan dengan While

Selain dengan For, kita juga dapat melakukan pengulangan dengan menggunakan While.

Pengulangan dengan while

$count = 1;
while ($count <=10)
print ("Baris nomer $count
$count = $count + 1;

Jika script di atas dijalankan maka akan muncul tampilan seperti di bawah ini.

Baris nomer 1
Baris nomer 2
Baris nomer 3
Baris nomer 4
Baris nomer 5
Baris nomer 6
Baris nomer 7
Baris nomer 8
Baris nomer 9
Baris nomer 10

Pengulangan tersebut akan terus dijalankan selama nilai $count lebih kecil atau sama dengan 10.

Download contoh


UI UX Designers Delhi said...

Blogging is the new poetry. I find it wonderful and amazing in many ways.

App Development Company London said...

After looking at a few of the blog articles on your site, I seriously appreciate your way of writing a blog.

GST Consultants Delhi said...

Good advice. I'll take it into account.

App Developers London said...

I really appreciate your professional approach. These are pieces of very useful information that will be of great use for me in future.