Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to perform a do-while?

I'm planning to use a do-while loop in MATLAB.
Is there a way to do that?

like image 275
Simplicity Avatar asked Feb 17 '13 10:02

Simplicity


People also ask

How do you execute a do-while?

Syntax. do { statement(s); } while( condition ); Notice that the conditional expression appears at the end of the loop, so the statement(s) in the loop executes once before the condition is tested. If the condition is true, the flow of control jumps back up to do, and the statement(s) in the loop executes again.

Is there a while do loop?

The do/while loop is a variant of the while loop. This loop will execute the code block once, before checking if the condition is true, then it will repeat the loop as long as the condition is true.

Does do-while execute once?

The 'do-while' loop is a variation of the while loop. 'do-while' loops always execute at least once, whereas while loops may never execute.


1 Answers

while(true)

%code

    if condition==false
        break; 
    end 
end
like image 160
Abhishek Thakur Avatar answered Sep 22 '22 16:09

Abhishek Thakur