Page 1 of 1

Small improvement to "introduction"

PostPosted: Thu Dec 16, 2010 1:14 pm
by johannes.krampf
In the introduction page you introduce assign multiple assignment in the Fibonacci example and use it to initialize variables. It would be useful to use it also for the calculation, because it makes the code imho clearer:

Code: Select all
--- fib.cobra.old   2010-12-16 21:10:33.000000000 +0100
+++ fib.cobra   2010-12-16 21:11:01.000000000 +0100
@@ -4,6 +4,4 @@
         n, a, b = 10, 0, 1
         for i in n
             print b
-            save = a
-            a = b
-            b += save
+            a, b = b, a + b

Re: Small improvement to "introduction"

PostPosted: Fri Dec 17, 2010 2:54 am
by Charles
Nice catch. I agree.

Re: Small improvement to "introduction"

PostPosted: Sat Dec 18, 2010 12:12 pm
by Charles
Done.

Re: Small improvement to "introduction"

PostPosted: Sat Dec 18, 2010 1:18 pm
by johannes.krampf
Thanks. Another small thing:

On the same page, in the last example, there's a def init instead of the correct cue init.

I don't know if this is deliberate to get new users acquainted with the documentation, but it confused me when I tried the example and I checked the code thrice to see if I made any typing errors until I made the change suggested by the compiler.

Re: Small improvement to "introduction"

PostPosted: Sat Dec 18, 2010 1:50 pm
by Charles
Wow, more "def init"s lurking in the docs. This inspired me to search the docs and find a couple more documents with this problem. Now fixed.