Primitives in V

Posted by yhuang
Public (Editable by Users)
V
None
Edit
// "bool" type
b1 := true
b2 := false

// "string" type
s := "hello"

// "rune" type - represents a Unicode code point
grinning_face := rune(0xf09f9880)

// numbers
n1 := i8(2)
n2 := byte(10)
n3 := i16(10)
n4 := u16(10)
n5 := 123 // Has the type "int"
n6 := u32(10)
n7 := i64(10)
n8 := u64(10)
n9 := 0.32 // Has the type "f32"
n10 := f64(0.32)

// pointers
p1 := byteptr(&s)
p2 := voidptr(&s)