Static Variables
Static variables belong to a class rather than an instance of the class. To define a static variable, use the static
keyword:
- Declare a static variable:
static var my_static_variable = 30
- Change the value of a static variable:
my_static_variable = 40
- Since statics belong to the class, you can also use
MyClass.my_static_variable = 40
Comments