Go က statically typed language ဖြစ်တဲ့အတွက် variable တစ်ခုမှာ ဘယ် type သိမ်းမလဲဆိုတာ compiler ကသိထားရပါတယ်။ Basic types တွေကို နားလည်ထားရင် function, struct, map, slice တွေကိုပိုမိုလွယ်ကူစွာရေးနိုင်ပါတယ်။
go
package main
import "fmt"
func main() {
age := 25
price := 19.99
name := "ThutaTech"
active := true
fmt.Printf("age: %T\n", age)
fmt.Printf("price: %T\n", price)
fmt.Printf("name: %T\n", name)
fmt.Printf("active: %T\n", active)
}%T က value တစ်ခုရဲ့ type ကို print ထုတ်ပေးတဲ့ format verb ပါ။ Integer, float, string, boolean စတာတွေက Go ရဲ့အခြေခံအုတ်မြစ်တွေပါ။
You should see
age: int price: float64 name: string active: boolInfo
ငွေကြေးတွက်ချက်မှုတွေမှာ floating point precision ပြဿနာရှိနိုင်လို့ production level မှာ decimal package သို့မဟုတ် integer cents ပုံစံကိုစဉ်းစားသင့်ပါတယ်။