[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting Out of a For Loop

From: Etienne Grossmann
Subject: Re: Getting Out of a For Loop
Date: Sat, 24 Jul 2021 18:11:32 -0700

Let's add an example:

for i = 1:100
  esq = rand(1) / 2^i;
  if esq <  1e-10
    printf ('At i=%i, esq=%g. G''bye\n', i, esq);

Good luck, Sam!


On Sat, Jul 24, 2021 at 2:57 PM Thomas D. Dean <> wrote:
On 7/24/21 2:47 PM, Samuel Doughty wrote:
> I need to get out of a FOR loop. I have written a simple IF test that I
> thought would work, but it does not. It was this, where esq has been
> previously evaluated:
>   if esq<1e-10
>      exitfor
>    endif
> What do I need to do differently, please?
> Thanks,
> Sam
help break

reply via email to

[Prev in Thread] Current Thread [Next in Thread]