🏠 Home / Hub

🧠 Programming Basics

Language မရွေး programming အခြေခံကို နားလည်ဖို့ variables, control flow, data types, functions, strings, operators, input/output နဲ့ number systems ကို တစ်နေရာတည်းမှာ စုထားတာပါ။

Variables

Variable ဆိုတာ value တစ်ခုကို နာမည်ပေးပြီး သိမ်းထားတာပါ။ Program ထဲမှာ ပြန်သုံး၊ ပြောင်း၊ တွက်ချက်နိုင်ပါတယ်။

name = "Mg Mg"
age = 20
age = age + 1

Constants

Constant က program run နေစဉ် မပြောင်းသင့်တဲ့ value ပါ။ ဥပမာ tax rate, max size, app name စတာတွေ။

PI = 3.14159
MAX_LOGIN_ATTEMPTS = 5

If Statements

Condition က true/false ဆုံးဖြတ်ပြီး code လမ်းကြောင်းခွဲပေးပါတယ်။ Login success/fail, pass/fail စတာတွေမှာ သုံးတယ်။

if score >= 40:
    print("Pass")
else:
    print("Fail")

Arrays

Array/List က value အများကြီးကို တစ်စုတည်း သိမ်းတဲ့ structure ပါ။ Items ကို index နဲ့ access လုပ်နိုင်ပါတယ်။

fruits = ["apple", "banana", "orange"]
print(fruits[0])

Loops

Loop က ထပ်ခါထပ်ခါလုပ်ရမယ့် code ကို short ဖြစ်အောင်ရေးပေးပါတယ်။

for i in range(1, 6):
    print(i)

Functions

Function က code block တစ်ခုကို နာမည်ပေးထားတာပါ။ Reuse လုပ်လို့ရပြီး program ကို သန့်စင်စေတယ်။

def greet(name):
    return "Hello " + name

Strings

String က text data ပါ။ Concatenate, search, replace, uppercase/lowercase စတဲ့ operation တွေရှိတယ်။

message = "Hello World"
print(message.upper())

Data Types

String
Text values
Number
Integer, float
Boolean
true / false
Array
List of values
Object
Key-value data

Operators

  • Arithmetic: + - * / %
  • Comparison: == != > < >= <=
  • Logical: and or not
  • Assignment: = += -=

Input and Output

Input က user/server/file က data ဝင်လာတာ၊ output က screen/file/API response ထွက်တာပါ။

name = input("Your name: ")
print("Welcome", name)

Bits, Binary, Hexadecimal & Boolean Algebra

Computer က data ကို bits 0/1 နဲ့သိမ်းပါတယ်။ Binary က base-2, hexadecimal က base-16 ဖြစ်ပြီး colors, memory address, low-level data တွေမှာတွေ့ရတယ်။ Boolean algebra က true/false logic ကိုနားလည်ဖို့အရေးကြီးပါတယ်။

Binary: 1010 = Decimal 10
Hex:    FF   = Decimal 255
Logic:  true AND false = false

📌 Study Checklist