12.07.2015 Views

GNU Octave - Local Sector 7 web page

GNU Octave - Local Sector 7 web page

GNU Octave - Local Sector 7 web page

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 12: Statements 83while (condition)bodyendwhileHere body is a statement or list of statements that we call the body of the loop, andcondition 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 executesthe statement body. After body has been executed, condition is tested again, and if it isstill true, body is executed again. This process repeats until condition is no longer true. Ifcondition 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 Fibonaccisequence.fib = ones (1, 10);i = 3;while (i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!