Created
March 23, 2024 01:07
-
-
Save epatel/6dd52de22726e36999d165a9862f8f40 to your computer and use it in GitHub Desktop.
Local var life
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<void> repeat(void Function() repeat) async { | |
while (true) { | |
await Future.delayed(Duration(seconds: 1)); | |
repeat(); | |
} | |
} | |
void test() { | |
int a = 7; | |
repeat(() { | |
print('Here! $a'); | |
}); | |
repeat(() { | |
a += 1; | |
}); | |
a = 5; | |
} | |
void main() { | |
print('Start'); | |
test(); | |
print('End'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment