Hello! So basically I’m trying to find out a way to interrupt a loop. My robot would follow certain instructions unless this “interruption” prevents it from finishing them. Does anyone know how to do this? Thanks in advance.
couldn’t you make the interruption the condition that your loop will run until? for example,
while(!conditionIsMet){
//code here
}
so basically the loop runs until your interrupting condition is met.
Does the “while (!)” mean that it is not true? (Sorry, I’m an amateur)
yes, !conditionMet
checks if the condition is not met, the (!) does this. so, you could put your code inside that while loop, and if the condition is met, the loop would end.
Okay, I’ll try that! Thank you!
@jennie As a brief aside from this thread, I strongly encourage you to figure out the timing code first (in your other thread), before attempting to incorporate loop interruption. Even though you have a competition soon, you will probably find that understanding the challenging timing code before trying to take on other new concepts will be worthwhile for your learning overall.