Bungee Logic : Schema : Var
Page Status: Beta
Contents |
Description
Declares a new variable in the current scope.
Syntax
var type name [ = value];
Where:
type Is the type you specify for the variable; for example, a string or an int. name Must be unique within the code block. The convention in Bungee is to use camel case (i.e. firstName) value Is the optional default value that you initialize the variable to.
Logic
The declaration of a variable appeares within the code as a var statement.
var int countBadApples;
You can use the Default Value property to initialize the variable.
var int countBadApples = 0;
Error Handling
-None-
Intrinsics
-None-
Properties
- Default Value — A site that determines the value that the variable is initialized with. For priimitive types like string, boolean, and int, the site should usually be a Data. For objects, the site should usually be an Object so that an actual runtime object gets created for the variable (unless the variable is meant to be a reference to another object).
- Name — The name of the variable.
- Type — The type of the variable. To change the type of the variable from the default of string, select the variable statement, and select the ellipsis button for the Type property on the Property Editor. The type selection dialog will appear that will allow you to select from the available types for the current project. To access the default types available in the Runtime, select the project->Dependencies->Runtime->Types project in the type selection tree.