How can we exit from a While loop?

Guys is there any script or any condition to come out of while or any condition?. Thanks @ashapkina

There is no explicit “Break” condition but if you think there is a potential issue with exiting the loop then one technique is to use a counter up to some max number of iterations then have the actual condition set the counter to that number if successful. For example:

Condition - process every line in a file. File may be corrupt (and maybe become huge) hanging the process so you could use:

Count = 1
Limit = 10,000

While count < Limit
Process line
if (no more lines) // This is the actual end condition - reached end of the file
set count = 10,000 // This is the backstop limit - count = 10,000 which we assume is the largest file size
else count = count +1