Forums

Small improvement to "introduction"

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Small improvement to "introduction"

Postby johannes.krampf » Thu Dec 16, 2010 1:14 pm

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
johannes.krampf
 
Posts: 11
Location: Suisse Romande

Re: Small improvement to "introduction"

Postby Charles » Fri Dec 17, 2010 2:54 am

Nice catch. I agree.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Small improvement to "introduction"

Postby Charles » Sat Dec 18, 2010 12:12 pm

Done.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: Small improvement to "introduction"

Postby johannes.krampf » Sat Dec 18, 2010 1:18 pm

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.
johannes.krampf
 
Posts: 11
Location: Suisse Romande

Re: Small improvement to "introduction"

Postby Charles » Sat Dec 18, 2010 1:50 pm

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.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 51 guests