-
Notifications
You must be signed in to change notification settings - Fork 4
Basic Type
GoblinBear edited this page Apr 11, 2019
·
5 revisions
nil-
UInt8/Int8 -
UInt16/Int16 -
UInt32/Int32 -
UInt64/Int64 Float32Float64BoolStringSliceMap
// boolean
b1 := types.NewBool(true)
b2 := types.NewBool(false)
// unsigned integer
un1 := types.NewUInt8(2)
un2 := types.NewUInt16(2)
un3 := types.NewUInt32(2)
un4 := types.NewUInt64(2)
// signed integer
si1 := types.NewInt8(-3)
si2 := types.NewInt16(-3)
si3 := types.NewInt32(-3)
si4 := types.NewInt64(-3)
// float
f1 := types.NewFloat32(0.456)
f2 := types.NewFloat64(0.456)
// string
str := types.NewString("Hello world")
// slice
slc := types.NewSlice([]types.RootType {
types.NewFloat32(0.456),
types.NewInt32(-3),
})
// map
m := types.NewMap(map[string]types.RootType {
types.NewUInt8(2),
types.NewBool(false),
})Call method Get()
v := types.NewUInt8(2)
data := v.Get()Call method Set()
v := types.NewUInt8(2)
v.Set(3)