Top

Basic data types

In the Z1h programming language, data types are used to declare functions and variables.

The emergence of data types is to divide the data into data with different memory sizes required. When programming, you need to apply for large memory when you need to use big data , You can make full use of memory.

Z1h language has the following data types by category:

Type Description Example
Boolean Can only be a constant true or false isZ1hGood = true
Number type Integer int, float64, etc. age = 1; pi = 3.1415
String type A sequence of characters connected by a string of fixed-length characters, using utf-8 encoding to identify Unicode Text name = 'Z1h'
derived types including pointers, arrays, structures, functions, Maps and other types obj = {name: 'Somebody', hi: e => {print ('Hello' + this.name) }}

numeric type

integer

type description minimum maximum
uint8 / byte unsigned 8-bit integer 0 255
uint16 Unsigned 16-bit integer 0 65535
uint32 Unsigned 32-bit integer 0 4294967295
uint64 Unsigned 64-bit integer 0 18446744073709551615
int8 Have 8-bit integer -128 127
Int16 signed 16-bit integer -3276 32767
int32 / rune Signed 32-bit integer -2147483648 2147483647
int64 Signed 64-bit integer -9223372036854775808 9223372036854775807

Please use the method of math_big standard library for larger numbers

Type Description
float32 IEEE-754 32-bit floating-point number
float64 IEEE-754 64-bit floating-point number

map and array

type description Example
map Key-value pair me = {name: 'zwr'}
[] Array lang = ['chinese', 'english']

In addition there are derived types

type description examples
[] byte byte array bytearray ("nihao") / "nihao" .bytes
[ ] rune runearray runearray ("nihao") / "nihao" .runes
Other types of arrays

Type conversion

directly use type (variable) for conversion

such as

a =" 123 "
print(a + 456) // 123456
print (int (a) + 456) // 579 

b = 888 
print (b + 111) // 999 
print (string (b) + 111) // 888111 
  • Go version Z1h can usestrconv standard library Function type conversion *