You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kameron Brooks edited this page Aug 17, 2019
·
1 revision
Variable Scope
CCL supports block scoping
strings="hello";
{
stringt=s+" world"; // t = "hello world"
}
print(t); // t is undefined in current scope
That means for loops, while loops, if statements, else statements, and elseif statements have their own scope. Variables declared inside of a block { } are not available outside of the brackets.
for(inti=0; i<10; i+=1) {
print(i); // i is defined
}
print(i) // i is not defined in current scope