diff options
Diffstat (limited to 'examples/allany.nim')
-rw-r--r-- | examples/allany.nim | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/examples/allany.nim b/examples/allany.nim deleted file mode 100644 index 8a5ab81f0..000000000 --- a/examples/allany.nim +++ /dev/null @@ -1,24 +0,0 @@ -# All and any - -template all(container, cond: untyped): bool = - var result = true - for it in items(container): - if not cond(it): - result = false - break - result - -template any(container, cond: untyped): bool = - 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" -else: - echo "does not work" - - |