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

Comments

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

Comments တွေက code ကို ဖတ်တဲ့လူနားလည်အောင် မှတ်ချက်ရေးတဲ့နေရာပါ။ Compiler က comments ကို run မလုပ်ပါ။ အရေးကြီး logic, formula, warning တွေကို မှတ်သားဖို့ကောင်းပေမယ့် code တစ်ကြောင်းတိုင်းကို comment ရေးဖို့တော့ မလိုပါ။

c
#include <stdio.h>

int main() {
  // Print a welcome message
  printf("Welcome to C!
");

  /* This block can be used
     for longer notes. */
  printf("Comments make code easier to read.");
  return 0;
}

// က single-line comment ဖြစ်ပြီး /* ... */ က multiple lines comment ပါ။ Program output ထဲမှာ comment တွေ မပေါ်ပါ။

You should see
Welcome to C! Comments make code easier to read.

Info

Comment က code ရဲ့ “ဘာကြောင့်” ကိုရှင်းပေးသင့်ပါတယ်။ Code က obvious ဖြစ်နေတဲ့အရာကို ထပ်ပြောရုံ comment မရေးတာ ပိုသန့်ပါတယ်။

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Multi-line comment ကို */ နဲ့မပိတ်မိရင် နောက်က code တွေပါ comment ထဲဝင်သွားနိုင်ပါတယ်။
Comments | Thuta Learning