Summary: | Interpreting Logo Source Code, IF Statements Work Three in Ten Times. | ||
---|---|---|---|
Product: | [Applications] kturtle | Reporter: | Iain Buclaw <tinivole> |
Component: | general | Assignee: | Cies Breijs <cies> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | piacentini |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Iain Buclaw
2008-01-23 07:27:35 UTC
What originally happened was that it would work. $x would get assigned to $a but then get reverted back to the original $x afterwards. After slightly altering the code I got it to work. But it only found a solution half the time... It should cover every decimal number between 1 and 10 right? It seems there is indeed a bug with if, apparently it does not work with even values? I need to check the source, but a simple way to reproduce this in 4.0: This works: reset $a = 0 repeat 3 { $a=$a+1 print $a if $a==1 { print "If ok" } } print "end" This does not work (comparing to 2) reset $a = 0 repeat 3 { $a=$a+1 print $a if $a==2 { print "If ok" } } print "end" This works also (comparing to 3) reset $a = 0 repeat 3 { $a=$a+1 print $a if $a==3 { print "If ok" } } print "end" Showstopper, I will see if I can fix it in time for 4.0.1 Additional info: it happens when the IF scope is nested inside another scope. Somewhere the variableTable gets erased or is not read in the correct scope, so one iteration works, and the next fails. Not to worry, as long as I am not going wrong, it's all nice to know! Though I have made a small work around that does work, instead of while i used "repeat" loop and instead of incrementing the $string number by one, its been done by 0.5. Though the downside is that I takes up more time to do it this way. repeat 18 [ if $x < ($y + 0.5) [ if $x > ($y - 0.5) [ code ] ] if $x > ($y - 0.5) [ if $x < ($y + 0.5) [ code ] ] $y = $y + 0.5 ] I don't have the logo file on this computer, but I think this is the general layout of what I did, but it doesn't workout in my head, so I'll have to check later if this is what I used. Though if I am right in this implementation, it would make sense that it is possible that it could work if the if scope is slightly messed up. By the way, what do you think of my attempt to write an extrinsic "truncate" function? Am I going the right way about it? or would you suggest a better method? Also, I must say this is a better program (though still in its early stages), I really noticed the better functionality with the intrinsic functions, It has a lot more potential for those "thinking outside the box" stuff. Keep up the good work! Thank-you. Iain Hi Iain, I fixed this bug a few days ago. All the examples given by Mauricio in his second comment work correctly with KTurtle in KDE 4.0.1. KDE 4.0.1 is due to be release on the 6th of February. Niels Fixed in 4.0 release and 4.1 |