Thread Subject: How to get back to a position in the code

Subject: How to get back to a position in the code

From: Diego Zegarra

Date: 21 Feb, 2009 20:02:02

Message: 1 of 2

Assume the code goes like this,

while ...
      if ... (1)
            if ... (2)

            else
                  break
            end
     end
end

In this code once it reaches the else, then the break makes it leave the while loop, how can I make that line to instead of getting out of the while loop to go back to the if statement (1)??

I know I can add another while statement same as the first but I think it would be nonsense. Like this,

while ...
      if ... (1)
           while ...
                if ... (2)

                else
                     break
                end
            end
     end
end

Subject: How to get back to a position in the code

From: per isakson

Date: 21 Feb, 2009 20:34:02

Message: 2 of 2

"Diego Zegarra" <diegozbb@gmail.com> wrote in message <gnpmjp$k0b$1@fred.mathworks.com>...
> Assume the code goes like this,
>
> while ...
> if ... (1)
> if ... (2)
>
> else
> break
> end
> end
> end
>
> In this code once it reaches the else, then the break makes it leave the while loop, how can I make that line to instead of getting out of the while loop to go back to the if statement (1)??
>
> I know I can add another while statement same as the first but I think it would be nonsense. Like this,
>
> while ...
> if ... (1)
> while ...
> if ... (2)
>
> else
> break
> end
> end
> end
> end

See: continue
/per

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
continue Matt Fig 21 Feb, 2009 18:22:43
break Diego Zegarra 21 Feb, 2009 15:05:04
rssFeed for this Thread

Contact us at files@mathworks.com