I am writing a program in Karel, which is basically Pascal plus motion commands for Fanuc robots. My code works, including looping through it 200 times with a for loop.
Now I want to add an exclusion list so in pseudocode" "for I=1 to 200 do unless I is on the exclusion list"
The list is: "array exclude[5] of integer" My code is:
for I=1 to 200 DO
FOR j =1 TO 5 DO
IF exclude[j]=i THEN
GO TO end_it
ENDFOR
bunch of code
endit::
ENDFOR
Now I know why I am getting a stack overflow, I am jumping out of the for loop. However, I can't come up with a way of how to solve my problem. I could check the 5 members of the array individually, but I am trying to keep my code short and sweet, especially since I have a second (third) for loop where I have to add the same thing again.
Any help will be appreciated!