if statement က condition ပေါ်မူတည်ပြီး ဘယ် code block ကို run မလဲဆုံးဖြတ်ပေးပါတယ်။ Login success/fail, score grade, user role permission, form validation စတဲ့နေရာတွေမှာအရေးကြီးပါတယ်။
swift
let score = 82
if score >= 90 {
print("Grade A")
} else if score >= 75 {
print("Grade B")
} else if score >= 60 {
print("Grade C")
} else {
print("Try again")
}Swift က condition တွေကို အပေါ်ကနေအောက်ကိုစစ်ပါတယ်။ score >= 90 မမှန်လို့ နောက် condition ကိုဆက်စစ်ပြီး score >= 75 မှန်တာကြောင့် Grade B ထုတ်ပါတယ်။
You should see
Grade B