Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
dotancohen
6y ago
0 comments
Share
And what if foo had already been defined in the scope?
0 comments
default
newest
oldest
munificent
6y ago
The new one shadows it.
dotancohen
OP
6y ago
Local scope might not be what the programmer wants, though, depending on circumstance. Pseudocode:
i = 3; foo = \0; while ( i-- ) { if ( foo = resultFromFooApi() ) { break; } sleep 1; } return foo;
j
/
k
navigate · click thread line to collapse