Thuta Learning
ရှာဖွေရန်
BasicProgrammingbeginner

Operators

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

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: True

Info

🔎 Operator groups

Arithmetic: + - * / %၊ Assignment: = += -=၊ Comparison: == != > < >= <=၊ Logical: && || !

Operators | Thuta Learning