Provides a description of the types of variables that can be used in a PBL program.
Variables are locations in memory (and sometimes in a database) in which data can be stored. Each variable has a name, description, type, and value. Most variables only store data of one particular type. For example, if you define a variable to store a number, it would not normally be used to store a text string.
Because data types are commonly fixed, the compiler will check to ensure that you are using correct type for the values your code assigns to them. If a statement is meant to process integers, the compiler will detect when you inadvertently try to use it to process another datatype, such as a string.
participantName = "John Doe" iso9001 = "..." _ugly_var_name_ = 1
//Variables cannot begin with numbers 4ever = true //display is a reserved word display = true
// This is legal because the reserved word // has been escaped @display = true // References to it must also include // the escape character display = @display
In this example, the '@' sign is not part of the variable name. It is just a way to tell the compiler that you are not referring to the reserved word but that you want to refer (in this case) to the variable.
The exact variable declaration syntax within a PBL program is dependant on the skin you are using, The following examples demonstrate how to declare variables using different programming styles:
name as String temp as Any
Dim name as String Dim temp as Any
String name; Any temp;
The term scope is used to denote the applicability or availability of a variable within your project. For example, variables defined within the code of a method have a local scope and are therefore called local variables. This means that they can only be seen from within the method where they are declared.