Scripting Variables

1. Introduction

Like in other programming languages, scripting variables in StudyCrafter act as containers for storing data values that can be changed during program execution. Different types of scripting variables are used to store different kinds of information. They can be used to store user input, control program flow, or perform calculations.

2. Properties

  • Variable Name: The variable name indicates the scripting variable you create. In StudyCrafter, you have to define the name of the variable. The name must be different from existing variable names. The name must start with a letter or underscore (_). The name can contain Unicode letter characters, decimal digit characters, Unicode connecting characters, Unicode combining characters, or Unicode formatting characters. For more information, see C# identifier naming rules and conventions.
  • Value Type: The value type of a variable in programming refers to the type of data that the variable can hold. In StudyCrafter, you can choose from different predefined value types:
    • Float: This type represents numbers that have a fractional part, separated from the integer part by a decimal point. For example, 3.14, -0.001, and 100.0 are floating-point numbers.
    • Integer: This type represents whole numbers without a decimal point. For example, -10, 0, and 42 are all integers.
    • String: This type represents textual data. For example, “Hello, world!” and “1234” are strings.
    • Boolean: This type has only two possible values: true and false. It is used for logical operations and conditions.
    • None: This is a special data type that represents the absence of a value. A variable set to None indicates that it has no value assigned to it, not even zero or an empty string. It is often used to denote default arguments, end of lists, or as a placeholder for optional values.
  • Init. Value: The initial value of a variable is the value assigned to it at the time of its creation or declaration. It determines the state of the variable when it first comes into use. To set the init. value for variables in StudyCrafter, see Variables.

3. Creating and Using Scripting Variables

Scripting variables must be created before they are used. To create scripting variables, please see “Scriptor Tab – Variables” in Onboarding. To use the scripting variables, please see “Using Variables in StudyCrafter” in Onboarding.