help-octave
[Top][All Lists]
Advanced

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

Re: while condition


From: Gabor Zoltan Csejtey
Subject: Re: while condition
Date: Tue, 6 Mar 2001 15:48:59 +0100 (MET)

Hi,

Try this:

i=10;

while (i--)
i
endwhile

Gabor Csejtey
NTNU, FIM, IDI
Email: address@hidden
Tlf: +47 735-93672

On Tue, 6 Mar 2001, SZABO Sandor wrote:

> Hello,
>
> In doc I found the following ones:
>
> function f (...)
>   while (nargin--)
>     disp (va_arg ())
>   endwhile
> endfunction
>
> ------
>
> Octave's while statement looks like this:
>
> while (condition)
>   body
> endwhile
>
> Here body is a statement or list of statements that we call the body of
> the loop, and condition is an expression that controls how long the loop
>
> keeps running.
>
> The first thing the while statement does is test condition. If condition
> is true, it executes the statement body. After body has been executed,
> condition is tested again, and if it is still true, body is executed
> again. This process repeats until condition is no longer true. If
> condition is initially
> false, the body of the loop is never executed.
>
> This example creates a variable fib that contains the first ten elements
> of the Fibonacci sequence.
>
> fib = ones (1, 10);
> i = 3;
> while (i <= 10)
>   fib (i) = fib (i-1) + fib (i-2);
>   i++;
> endwhile
>
> -----------
> I would like to know what is the condition in
>
>     while (nargin--)
>
> Sandor Szabo
>
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------
>



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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