PDA

View Full Version : Loop breaks


hugelgupf
09-30-2009, 02:41 PM
Hi,

atm I'm sitting in the Comp Science lesson and a bit confused.

I let a person walk, called Bob. While the up-key is pressed, it calls the following methods:
begin: bob.walkFirstStep
during: bob.walk
end: bob.walkLastStep

In bob.walk, there is a loop (i also tried while(true)), containing 2 DoTogethers and a lot of things inside of those. When I press "up" now and when I leave "up" after 2 steps, it screws everything up, because the loop is broken in between the 2 DoTogethers. How can I let Alice complete the whole loop, when I leave a key? (What a strange behavior...)

By the way, I wonder how DoTogether works, since Java is procedural... Do you split it up? What a work...

It's alice 2.2 beta 4/30/09

- Chris

lanceA
09-30-2009, 07:06 PM
Hi,

atm I'm sitting in the Comp Science lesson and a bit confused.

I let a person walk, called Bob. While the up-key is pressed, it calls the following methods:
begin: bob.walkFirstStep
during: bob.walk
end: bob.walkLastStep

In bob.walk, there is a loop (i also tried while(true)), containing 2 DoTogethers and a lot of things inside of those. When I press "up" now and when I leave "up" after 2 steps, it screws everything up, because the loop is broken in between the 2 DoTogethers. How can I let Alice complete the whole loop, when I leave a key? (What a strange behavior...)

By the way, I wonder how DoTogether works, since Java is procedural... Do you split it up? What a work...

It's alice 2.2 beta 4/30/09

- Chris

Due to time constraints I can only repsond to your last question: DoTogether.

Java is not a procedural language. It is commonly referred to as OOP - Object Oriented Programming. However Java allows multi-threading which means it can process multiple tasks simultaneously.

Good luck with your other question,

hugelgupf
10-01-2009, 11:28 AM
Due to time constraints I can only repsond to your last question: DoTogether.

Java is not a procedural language. It is commonly referred to as OOP - Object Oriented Programming. However Java allows multi-threading which means it can process multiple tasks simultaneously.

Good luck with your other question,

Nice... but despite I will never like Java :D