Snowball provides a set of primitive types that serve as the building blocks for representing basic data in your programs. These types are essential for storing and manipulating fundamental values. Here are the primitive types in Snowball:
Integer types
i[n]
: n-bit signed integer type.examples:
i32
,i64
,i39
u[n]
: n-bit unsigned integer type.examples:
u8
,u32
,u128
Integer type sizes can only go from 1 (bool
) to 2^23 (8,388,608)
Floating-Point Types
f32
: 32-bit floating-point type (single-precision).f64
: 64-bit floating-point type (double-precision).f16
: (Not implemented yet!)
Boolean Type
bool
: A Boolean type representing eithertrue
orfalse
.
Character Type:
char
: A character type representing a single Unicode character. (u8)
Other unsized types
These are types that do not implement the Sized
trait, and therefor, it can't be used in variables, arguments, etc...
These primitive types provide the foundation for representing and manipulating various kinds of data in Snowball programs. They have different sizes and properties, allowing you to choose the appropriate type based on your specific requirements.
By understanding and utilizing these primitive types effectively, you can perform arithmetic operations, and logical evaluations, and handle textual data within your Snowball programs.
Last updated