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

What is Swift?

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

Swift သည် Apple ecosystem အတွက် အဓိကအသုံးများတဲ့ modern programming language ဖြစ်ပါတယ်။ iPhone app, iPad app, Mac app, Apple Watch app, Apple TV app တွေတည်ဆောက်ရာမှာ Swift ကိုအများကြီးအသုံးပြုကြပါတယ်။ Server-side Swift နဲ့ Linux ပေါ်မှာလည်း အသုံးပြုနိုင်ပါတယ်။

Swift ရဲ့ အားသာချက်က code ဖတ်ရလွယ်ခြင်း၊ error ဖြစ်နိုင်တဲ့နေရာတွေကို compile time မှာစောစောသတိပေးခြင်း၊ performance ကောင်းခြင်း၊ modern app development pattern တွေနဲ့ လိုက်ဖက်ခြင်းတို့ပါ။

swift
// Swift code ကို Playground ထဲမှာ တိုက်ရိုက် run ကြည့်နိုင်ပါတယ်။
print("Hello, Swift!")

print() က console ထဲကို text ထုတ်ပြတဲ့ function ဖြစ်ပါတယ်။ Swift မှာ simple script လိုမျိုး file ထိပ်ဆုံးကနေ code ရေးပြီး run လို့ရတဲ့အတွက် စတင်လေ့လာတဲ့အချိန်မှာ အဆင်ပြေပါတယ်။

You should see
Hello, Swift!

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

  • print(Hello) လို့ quote မထည့်ဘဲရေးရင် Swift က Hello ကို variable name လို့ယူဆပြီး error ပြနိုင်ပါတယ်။