๐Ÿ’ผMembers

In Snowball, class variables are members of a class that are shared among all instances of the class. They are also known as static variables or class-level variables. Class variables maintain their value across different instances of the class and can be accessed directly through the class itself. Here's an explanation of class variables in Snowball:

You must specify the variable type when declaring a class member.

class Y {
    let x: i32;
//         ^^^
    let b: f32 = 3.14;
//               ^^^^ Initialized at the constructor
}

Variables can have default initializers and they will be initialized when the constructor is called.

Last updated