print('entry'); var label; var state; var decisions = [3, 3, 4, 1, 2, 1, 2, 4, 4, 4, 2, 3, 3, 1, 2]; var index = 0; function check() { if (index == decisions.length) throw 'HALT'; return decisions[index++] } switch (the_var) { default: { } } print(1); state = check(); switch (the_var) { default: { } } print(3); state = check(); switch (the_var) { default: { } } while(1) { print(4); state = check(); switch (the_var) { default: { } } }