Bug 178186 - Nested for loops doesn’t work in KTurtle
Summary: Nested for loops doesn’t work in KTurtle
Status: RESOLVED FIXED
Alias: None
Product: kturtle
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Cies Breijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-19 16:01 UTC by Karl Ove Hufthammer
Modified: 2009-01-07 21:23 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karl Ove Hufthammer 2008-12-19 16:01:29 UTC
Version:           0.8 beta (using 4.1.3 (KDE 4.1.3), Mandriva Linux release 2009.0 (Official) for i586)
Compiler:          gcc
OS:                Linux (i686) release 2.6.27.5-desktop-2mnb

Nested for loops don’t seem to work. When I try the following code (which should print a multiplication table), I get the error message 'The variable '$x' was used without first being assigned to a value'

reset

for $x = 1 to 10 {
for $y = 1 to 10 {
    go 30*$x,30*$y
    print $x*$y
}
}
Comment 1 Niels Slot 2008-12-20 17:53:45 UTC
SVN commit 899390 by nielsslot:

Make nested for loops work. This solution works, but probably isn't the best. We should have a look at it again after 4.2 is released.

BUG: 178186


 M  +4 -2      executer.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=899390
Comment 2 Karl Ove Hufthammer 2009-01-07 20:32:32 UTC
The fix applied doesn’t work properly. For the above example, it skips the value of y = 1 for all values of x except x = 1.

I also got KTurtle to crash by changing the y loop to go from y = 1 to 1, but can’t reproduce that.
Comment 3 Niels Slot 2009-01-07 21:15:58 UTC
SVN commit 907287 by nielsslot:

Make nested for loops work for y = 1. See bug 178186.

BUG: 178186


 M  +14 -3     definitions.rb  
 M  +10 -1     executer.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=907287
Comment 4 Niels Slot 2009-01-07 21:23:16 UTC
Karl: I just committed a fix. I now get a 10 by 10 table when running your script in KTurtle. If you encounter the crash again and are able to reproduce, please file another bug.