Operators တွေက values တွေကိုတွက်ချက်တာ၊ နှိုင်းယှဉ်တာ၊ condition စစ်တာတွေမှာ အသုံးပြုတဲ့ symbols တွေပါ။ Calculator ထဲက +, - လိုပဲ programming မှာလည်း operator တွေက logic ရဲ့ အလုပ်သမားလေးတွေပါ။
csharp
int price = 100;
int quantity = 3;
int total = price * quantity;
bool hasDiscount = total >= 300;
Console.WriteLine($"Total: {total}");
Console.WriteLine($"Discount allowed: {hasDiscount}");ဒီ code မှာ ဘာတွေတွေ့ရမလဲ
*က multiplication operator ဖြစ်ပြီး price နဲ့ quantity ကိုမြှောက်ပါတယ်။>=က comparison operator ဖြစ်ပြီး total က 300 ထက်ကြီး/ညီလား စစ်ပါတယ်။- Comparison result က
trueသို့မဟုတ်falseဖြစ်ပါတယ်။
You should see
Total: 300 Discount allowed: TrueInfo
🔎 Operator groups
Arithmetic: + - * / %၊ Assignment: = += -=၊ Comparison: == != > < >= <=၊ Logical: && || !