-
Notifications
You must be signed in to change notification settings - Fork 1
TYP005
ricardoboss edited this page Oct 19, 2023
·
1 revision
This exception is thrown when a variable is declared more than once in the same scope.
Example:
number a = 1
number a = 2
Make sure that each variable is only declared once in each scope or give each variable a different name:
number a = 1
- number a = 2
+ number b = 2
You can also overwrite the value of a variable by leaving out the type:
number a = 1
- number a = 2
+ a = 2
You can use anonymous code blocks to separate different scopes.
This is valid:
number a = 1
println(a) // prints 1
{
number a = 2
println(a) // prints 2
}
println(a) // prints 1
© 2023 Ricardo Boss • Licensed under MIT • Want to update this page? Edit it on GitHub and submit a pull request!