I'm looking at a function that creates a local variable in an if statement. If someone called that function and the condition to the if statement was not triggered, that local variable wouldn't exist, right?
1 Answer
Yes. It's like other languages it won't exist in out of the scope.
solc compiler give you Undeclared identifier
error.
for example
if (everything) {
uint testVariable = 1;
}
require(testVariable == 1, "error"); // you will have Undeclared identifier error in here