summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xexamples/fizzbuzz.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/fizzbuzz.nim b/examples/fizzbuzz.nim
new file mode 100755
index 000000000..4b203512c
--- /dev/null
+++ b/examples/fizzbuzz.nim
@@ -0,0 +1,14 @@
+# Fizz Buzz program
+
+const f = "Fizz"
+const b = "Buzz"
+for i in 1..100:
+  if i mod 15 == 0:
+    echo f, b
+  elif i mod 5 == 0:
+    echo b
+  elif i mod 3 == 0:
+    echo f
+  else:
+    echo i
+