selama (while)
Description / Deskripsi
Section titled “Description / Deskripsi”The selama keyword starts a while loop in SamaLang.
It is equivalent to while in standard Lua.
Keyword selama digunakan untuk memulai perulangan while dalam SamaLang.
Setara dengan while di Lua.
Usage / Penggunaan
Section titled “Usage / Penggunaan”selama condition boat -- codejure_moExamples
Section titled “Examples”Countdown
Section titled “Countdown”ada hitung = 5
selama hitung > 0 boat tulis(hitung) hitung = hitung - 1jure_mo
tulis("Lepas landas!")-- Output: 5, 4, 3, 2, 1, Lepas landas!Sum Until Limit
Section titled “Sum Until Limit”ada total = 0ada i = 1
selama total < 100 boat total = total + i i = i + 1jure_mo
tulis("Total: " .. tostring(total))tulis("Iterasi: " .. tostring(i - 1))With Break
Section titled “With Break”ada angka = {10, 20, 30, 40, 50}ada i = 1
selama i <= #angka boat lamen angka[i] == 30 tres tulis("Ketemu: 30") jangka_mo jure_mo i = i + 1jure_mo