atau (or)
Description / Deskripsi
Section titled “Description / Deskripsi”The atau keyword is the logical OR operator in SamaLang. It returns true if at least one operand is true.
It is equivalent to or in standard Lua.
Keyword atau adalah operator logika OR dalam SamaLang. Menghasilkan true jika setidaknya satu operand bernilai true.
Setara dengan or di Lua.
Usage / Penggunaan
Section titled “Usage / Penggunaan”lamen operand1 atau operand2 tres -- code runs when at least one is truejure_moExamples
Section titled “Examples”Basic OR
Section titled “Basic OR”ada a = tutuada b = siong
lamen a atau b tres tulis("Minimal satu benar")jure_mo-- Output: Minimal satu benarDefault Value Pattern
Section titled “Default Value Pattern”ada nama = nda_isinama = atau nama "Pengguna"tulis(nama) -- Output: PenggunaWith Comparison
Section titled “With Comparison”ada suhu = 38
lamen suhu > 37 atau suhu < 35 tres tulis("Suhu tidak normal")jure_mo-- Output: Suhu tidak normalShort-Circuit Evaluation
Section titled “Short-Circuit Evaluation”fungsi cek(n) tulis("Fungsi dipanggil") semalik n > 0jure_mo
ada nilai = -1
-- cek(nilai) tidak dipanggil karena kondisi pertama truelamen nilai < 0 atau cek(nilai) tres tulis("Negatif")jure_mo-- Output:-- Negatif-- (cek() not called because first operand is true)