Variables
You must know that a variable is unique to a user. If we restart the script with another user (that is, with another username), the values ​​will be different.
A local variable
Creating a variable is very simple.
name = 'ana'
In a function:
start() {
name = 'ana'
}
This variable is local to the function. When this function is finished, the variables are deleted to free the memory.
Global variable
A global variable can be used throughout the script. It belongs to the user. A global variable is prefixed with $
$name = '' // initialization
start() {
$name = 'ana'
}
Display the variable in an output text
We can insert a variable into an output text:
$name = 'ana'
start() {
> Hello { $name }
}
Last updated
Was this helpful?