From 077e9e35acd294e454b8c86e9c8cdb7ecdbaaef8 Mon Sep 17 00:00:00 2001 From: Erik Demaine Date: Wed, 11 Sep 2024 18:44:34 -0400 Subject: [PATCH] Document `break with`/`continue with` --- civet.dev/reference.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/civet.dev/reference.md b/civet.dev/reference.md index b4a73704..43d9ce77 100644 --- a/civet.dev/reference.md +++ b/civet.dev/reference.md @@ -1726,6 +1726,24 @@ Labels have the colon on the left to avoid conflict with implicit object literals. The colons are optional in `break` and `continue`. ::: +### Controlling Loop Value + + +function varVector(items, mean) + for item of items + continue with 0 unless item? + item -= mean + item * item + + + +found := + loop + item := nextItem() + break with item if item.found + process item + + ## Other Blocks ### Try Blocks