Don't click here unless you want to be banned.

LSL Wiki : DoWhile

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are


A do-while loop is similar to a while loop, but the order in which the parts are executed is different.


} while (condition);


    llSay(0, "monkey!");
} while (monkeysRemain());

This code will say "monkey!" once, and then continue saying "monkey!" as long as the function monkeysRemain() returns TRUE.

In a do-while loop, the statements are always executed at least once, then the condition is checked, and if it evaluates true, the statements are repeated.

A do-while loop is used to execute the statements one time, and then additional times. For a loop that executes statements only when a specific condition is true, see the while loop.

Finding a time to use this is rare. It's a wrong solution when I use it (so the section ends up getting re-written). -BW

Accoding to Strife replacing a while loop with a do{}while wrapped in an if statement reduces bytecode size. -Chris

It also executes faster than a while loop, (the bytecode savings is 5 bytes) -BW aka Strife

Note: Because of the way LSL parser works (more details:, conditions in LSL are evaluated left to right, instead of right to left as in most programming languages. Check example on condition page.

Flow Control | While | if-else Jasa SEO Jasa SEO Murah Sepatu Online Toko Sepatu Online Sepatu Sepatu Murah Sepatu Safety Sepatu Futsal Cheapes Hostgator Coupon Link Booking Televisori offerte Notebook Offerte Berita Terkini Internet Marketer Muda Internet Marketer Indonesia Portatile Apple RDAnet Lorks Karikatur Bisnis Modal Kecil Bisnis UKM Berita Terbaru Iklan Baris Jasa SEO Jasa SEO Murah SEO Indonesia Konsultan SEO SEO Belajar SEO Kursus SEO Kursus SEO Murah Jam Tangan Casio Jam Tangan Casio Jam Tangan Murah Jam Tangan Grosir Baju Terbaru Grosir Baju Baju Terbaru Grosir Baju Murah Bisnis Online Belajar SEO Kerupuk Kerupuk kulit Social Bookmark Dofollow Social Bookmark Kumpulan Puisi Kirim Puisi bola hantu Penumbuh Rambut Penumbuh Rambut timbangan WBC Wonogiri Jasa SEO Murah Jasa SEO Jam Tangan Murah
Comments [Hide comments/form]
Attach a comment to this page: