diff --git a/programs/test.sol b/programs/test.sol index 6c8ec6b..5466e90 100644 --- a/programs/test.sol +++ b/programs/test.sol @@ -408,4 +408,12 @@ for i in l do print(i) end +print('--- Control expressions') + +print('1 is', if 1 then 'true' else 'false' end) +print('0 is', if 0 then 'true' else 'false' end) + +print(for i in l do continue 1000 + 2 * i end) +print(for i in l do print('(', i, ')') if i >= 5 then break i end end) + print('--- All done!') diff --git a/runtime.c b/runtime.c index cbfb503..ad46e7a 100644 --- a/runtime.c +++ b/runtime.c @@ -838,6 +838,7 @@ sol_object_t *sol_eval_inner(sol_state_t *state, expr_node *expr, jmp_buf jmp) { sol_obj_free(item); if(state->ret || state->sflag == SF_BREAKING || sol_has_error(state)) { item = sol_incref(state->StopIteration); + continue; } state->sflag = SF_NORMAL; item = CALL_METHOD(state, iter, call, list);