-
Notifications
You must be signed in to change notification settings - Fork 2
EN: Chapter 1: Yolang's data types
This is XiaoDeng edited this page Oct 22, 2022
·
1 revision
In this chapter, you will learn about the data types in Yolang and use them
In Yolang, data types are divided into basic data types and composite data types, and the following is a table of basic data types and composite data types.
Represented keywords/NativeClass name/symbolic name | Explanation |
---|---|
integer | keyword, integer, which is often referred to as an integer (with sign) |
decimal | keyword, floating point, which is often referred to as decimal (with sign) |
boolean | keyword, a boolean type with only two values, true or false |
null | keyword, null type, can be used as both a value and a type keyword |
string | NativeClass name, a string |
object | symbolic name, stands for all instantiable types, including struct, class |
compositeName | explanation | representation |
---|---|---|
list | list type | [1, 2, 3, 4, 5, 6, 7] |
list_like_struct | A structure of type list | {1, "hello", true, null} |
struct | initialized structure | `{a: 1, b: "hello", c: true, d: null} (this example is not accepted in yolang, it is written to visually represent the difference between list-like structure and struct) |
ref | Reference types (not yet implemented in the current version) | not implemented, no examples available |
norm | ordinary types, i.e., types other than other composite types | are used to distinguish composite types from other composite types, which is the most common representation, e.g., 123
|
where, for a list composite type, its type identifier should be written like this
integer[]
decimal[]
null[]
Translated with www.DeepL.com/Translator (free version)