Variables
One can define variable and constant in this way:
With Hedgehog Script you can use the keyword
let
for a variable, for example,let x = 10;
For constants, you can use keyword
const
, for example,const x = 10
const
means constant as the variable can't change or be redeclared
warning
Do not define variables with no keyword, this is the same as saying var variableName = value
And regarding var
, it should never be used!
Let's view a simple example of variable declaration:
One can also declare multiple variables quickly, in one line:
caution
Declare variables at the top of the scope they're used in.
And certainly declare them before intializing them.
tip
For more detailed information visit: Variables (let) - MDN and Variables (const) - MDN