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
import 'dart:math'; | |
void main() { | |
var rng = new Random(); | |
for (int i = 0; i < 21; i++) { | |
var v = rng.nextInt(5); | |
switch (v) { | |
case 1: | |
print("v=$v first case"); | |
break; |
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
#define a value holder function | |
# => True | |
def switch(value): | |
switch.value=value | |
return True | |
#define matching case function | |
# => True or False | |
def case(*args): | |
return any((arg == switch.value for arg in args)) |