UnitializedVariable
rascal-0.40.17
Synopsis
Use of a variable that has not been initialized.
Description
A variable has to be initialized before it can be used. This error is generated when an uninitialzed variable is used.
Remedy: assign a value to the variable before its use:
Examples
Using the uninitialized variable x
gives an error:
rascal>x
|prompt:///|(0,1,<1,0>,<1,1>): Undeclared variable: x
Advice: |https://www.rascal-mpl.org/docs/Rascal/Errors/CompileTimeErrors/UndeclaredVariable|
ok
This can be avoided by first initializing x
by an Assignment:
rascal>x = 3;
int: 3
rascal>x + 5;
int: 8
Or it can be avoided by declaring x
using a Variable:
rascal>int x = 3;
int: 3
rascal>x + 5;
int: 8