diff options
-rw-r--r-- | examples/allany.nim | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/examples/allany.nim b/examples/allany.nim index 6ff055aa6..8a5ab81f0 100644 --- a/examples/allany.nim +++ b/examples/allany.nim @@ -1,22 +1,20 @@ # All and any template all(container, cond: untyped): bool = - block: - var result = true - for it in items(container): - if not cond(it): - result = false - break - result + var result = true + for it in items(container): + if not cond(it): + result = false + break + result template any(container, cond: untyped): bool = - block: - var result = false - for it in items(container): - if cond(it): - result = true - break - result + var result = false + for it in items(container): + if cond(it): + result = true + break + result if all("mystring", {'a'..'z'}.contains) and any("myohmy", 'y'.`==`): echo "works" |