Browse Source

Sol Part 51: Break Unbroken!

Graham Northup 4 years ago
parent
commit
7884cda9c4
Signed by: Grissess <grissess@nexusg.org> GPG Key ID: 5D000E6F539376FB
2 changed files with 9 additions and 0 deletions
  1. 8
    0
      programs/test.sol
  2. 1
    0
      runtime.c

+ 8
- 0
programs/test.sol View File

@@ -408,4 +408,12 @@ for i in l do
408 408
 	print(i)
409 409
 end
410 410
 
411
+print('--- Control expressions')
412
+
413
+print('1 is', if 1 then 'true' else 'false' end)
414
+print('0 is', if 0 then 'true' else 'false' end)
415
+
416
+print(for i in l do continue 1000 + 2 * i end)
417
+print(for i in l do print('(', i, ')') if i >= 5 then break i end end)
418
+
411 419
 print('--- All done!')

+ 1
- 0
runtime.c View File

@@ -838,6 +838,7 @@ sol_object_t *sol_eval_inner(sol_state_t *state, expr_node *expr, jmp_buf jmp) {
838 838
 				sol_obj_free(item);
839 839
 				if(state->ret || state->sflag == SF_BREAKING || sol_has_error(state)) {
840 840
 					item = sol_incref(state->StopIteration);
841
+					continue;
841 842
 				}
842 843
 				state->sflag = SF_NORMAL;
843 844
 				item = CALL_METHOD(state, iter, call, list);

Loading…
Cancel
Save