What is the most compact form of a break?

1 view (last 30 days)
Mr M.
Mr M. on 7 Dec 2014
Commented: dpb on 18 Feb 2015
Usually in a while loop 'if (...)', 'break', and 'end' goes to different lines, but I would like to use a compact form in one line, if possible.

Accepted Answer

dpb
dpb on 7 Dec 2014
Edited: dpb on 7 Dec 2014
Then do so... :)
condition=false;
while ~feof(fid)
condition=somefunctionofsomthinghere;
if condition, break, end
...
end
I like the compact form for the purpose and write this as the above all the time, as well...
  4 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!