Path: news.mathworks.com!newsfeed-00.mathworks.com!NNTP.WPI.EDU!elk.ncren.net!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Newsgroups: comp.soft-sys.matlab
Subject: Re: do while
Date: Thu, 15 May 2008 16:57:42 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 29
Message-ID: <g0hq26$q1o$1@canopus.cc.umanitoba.ca>
References: <g0gt2m$h3q$1@fred.mathworks.com> <g0hp1j$k93$1@fred.mathworks.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1210870662 26680 192.70.172.160 (15 May 2008 16:57:42 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Thu, 15 May 2008 16:57:42 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:468630


In article <g0hp1j$k93$1@fred.mathworks.com>,
Steve Amphlett <Firstname.Lastname@Where-I-Work.com> wrote:
>"Deo " <spliers@hotmail.com> wrote in message 
><g0gt2m$h3q$1@fred.mathworks.com>...
>> is there a matlab command equivalent to the C do while

>Another abomination:

>first=true;
>while(condition || first)

>% stuff

>first=false;
>end

Evaluating condition might have side effects. To match do while
those side effects should not be triggered on the first trip.
Therefore the above should be rewritten to

first=true;
while(first || condition)
% stuff
first=false;
end
-- 
   So you found your solution
   What will be your last contribution?
   -- Supertramp (Fool's Overture)