1. In a for or while loop, if the condition is breached in the middle of the brackets {}, will the code immediately stop the loop, or wait until it gets to the bottom of the brackets {} ?

2. If a function is called in my code, does the computer wait until the function is finished before continuing with the rest of the code?

Recommended Answers

All 2 Replies

1. In a for or while loop, if the condition is breached in the middle of the brackets {}, will the code immediately stop the loop, or wait until it gets to the bottom of the brackets {} ?

2. If a function is called in my code, does the computer wait until the function is finished before continuing with the rest of the code?

#1. Wait until it gets to the bottom, it will.

#2. Yes it does.

You can perform your own test inside the loop and use the break statement to break out of the loop.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.