mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
further development of httpserver
This commit is contained in:
17
examples/allany.nim
Executable file
17
examples/allany.nim
Executable file
@@ -0,0 +1,17 @@
|
||||
# All and any
|
||||
|
||||
template all(container, cond: expr): expr =
|
||||
block:
|
||||
var result = true
|
||||
for item in items(container):
|
||||
if not cond(item):
|
||||
result = false
|
||||
break
|
||||
result
|
||||
|
||||
if all("mystring", {'a'..'z'}.contains):
|
||||
echo "works"
|
||||
else:
|
||||
echo "does not work"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user