Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i wrote new example program #69

Merged
merged 3 commits into from
Nov 29, 2011
Merged

i wrote new example program #69

merged 3 commits into from
Nov 29, 2011

Conversation

takano32
Copy link
Contributor

Fizz Buzz is a majar example program in recent.

would you accept my Fizz Buzz program, if you dont mind.

@Araq
Copy link
Member

Araq commented Nov 28, 2011

Use 'elif' instead of 'continue'. Use 'echo a, b' instead of 'echo a & b'. Use 'const' instead of 'var'. Sorry for the nitpicking, but people like examples to be idiomatic nimrod code ;-).

@takano32
Copy link
Contributor Author

OK! i see! ill fix it.
thak you for your precise advises, very thanks! :-)

@takano32
Copy link
Contributor Author

very thanks! and ill commit in a minutes!

diff --git a/examples/fizzbuzz.nim b/examples/fizzbuzz.nim
index 8928026..5807549 100755
--- a/examples/fizzbuzz.nim
+++ b/examples/fizzbuzz.nim
@@ -1,16 +1,14 @@
 # Fizz Buzz program

-var f = "Fizz"
-var b = "Buzz"
+const f = "Fizz"
+const b = "Buzz"
 for i in 1..100:
-  if i mod 15 == 0:
-    echo f & b
-    continue
-  if i mod 5 == 0:
-    echo b
-    continue
   if i mod 3 == 0:
     echo f
-    continue
-  echo i
+  elif i mod 5 == 0:
+    echo b
+  elif i mod 15 == 0:
+    echo f, b
+  else:
+    echo i

@Araq
Copy link
Member

Araq commented Nov 29, 2011

You need to check for 'mod 15' before 'mod 3' and 'mod 5'. ;-)

Araq added a commit that referenced this pull request Nov 29, 2011
i wrote new example program
@Araq Araq merged commit 48b940b into nim-lang:master Nov 29, 2011
reactormonk pushed a commit to reactormonk/nim that referenced this pull request Apr 7, 2014
krux02 pushed a commit to krux02/Nim that referenced this pull request Jan 11, 2022
69: make cancelled CI a failure r=alaviss a=alaviss

nim-lang#65 managed to skip through bors by having its CI cancelled. This is not optimal and has to be fixed.

Co-authored-by: alaviss <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants