Introduction to Robotics/Control Flow/Lecture/Teachers: Difference between revisions
wikademia>Whiteknight |
wikademia>Dr. Eme m moved Beta:Introduction to Robotics/Control Flow/Lecture/Teachers to Introduction to Robotics/Control Flow/Lecture/Teachers over redirect |
||
| (7 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{ | {{ntnes}} | ||
== Control Flow == | == Control Flow == | ||
| Line 13: | Line 13: | ||
We can “nest” FOR / NEXT loops. “nesting” means that we put one loop inside another loop. When we nest FOR / NEXT loops, we need to use different counter-variables for each loop. | We can “nest” FOR / NEXT loops. “nesting” means that we put one loop inside another loop. When we nest FOR / NEXT loops, we need to use different counter-variables for each loop. | ||
{{Introduction to Robotics/Visual| | {{Introduction to Robotics/Visual|Nested Loops 1}} | ||
}} | |||
If we use the same counter-variable, the variable will be changing in the inner loop, and the outer loop will not work correctly: | If we use the same counter-variable, the variable will be changing in the inner loop, and the outer loop will not work correctly: | ||
{{Introduction to Robotics/Visual| | {{Introduction to Robotics/Visual|Nested Loops}} | ||
}} | |||
=== How it Works === | === How it Works === | ||
| Line 48: | Line 29: | ||
#If the counter variable is not equal to the TO value, go to #2 | #If the counter variable is not equal to the TO value, go to #2 | ||
{{Introduction to Robotics/Visual| | {{Introduction to Robotics/Visual|FOR NEXT Control Flow}} | ||
== Labels and GOTO == | == Labels and GOTO == | ||
| Line 54: | Line 35: | ||
Labels are like destination points. When we put a label in our code, we can jump to it using a GOTO statement. | Labels are like destination points. When we put a label in our code, we can jump to it using a GOTO statement. | ||
{{Introduction to Robotics/Visual| | {{Introduction to Robotics/Visual|Labels and GOTO}} | ||
}} | |||
== Branches == | == Branches == | ||