[Top][All Lists]

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

while condition

From: SZABO Sandor
Subject: while condition
Date: Tue, 06 Mar 2001 15:04:42 +0100


In doc I found the following ones:

function f (...)
  while (nargin--)
    disp (va_arg ())


Octave's while statement looks like this:

while (condition)

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 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:
How to fund new projects:
Subscription information:

reply via email to

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