TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Octave

Octave while Statement

Overview

In this tutorial, we will learn about Octave while statement. The while statement is a loop statement in Octave.

while Statement

Octave’s  while statement syntax is as follows:

while (condition)

    body

endwhile

 

or

 

while (condition)

    body

end

 

The while statement executes the loop statements as long as the while condition is true. The condition expression in the while statement is considered true if its value is non-zero, and false if its value is zero.

The while is an indefinite loop. We can use this loop when we don’t know beforehand the number of iterations for the loop. The loop executes until the loop condition is true.

Example

% Sample Octave Script
% while Loop Demo
% Octave Tutorials – www.TestingDocs.com

% Initialize loop variable
loopVar = 1;

% While Loop to print 1 – 10
while( loopVar <= 10)
        disp(loopVar);
       loopVar++;
endwhile

Screenshot

Octave while Loop

—

Octave Tutorials

Octave Tutorial on this website can be found at:
https://www.testingdocs.com/octave-tutorial/

More information on Octave can be found on the official website:
https://www.gnu.org/software/octave/index

Related Posts

Octave Package List

Octave /

Install Octave Packages on Linux

Octave /

Octave User defined Function Example

octave command line linux

Octave /

Octave Command line on Ubuntu

Hello World in Octave

Octave /

Hello World in Octave

Octave /

Octave plot example of function y=x^2

‹ Octave If Statement› Octave for Statement

Recent Posts

  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Print Triangle Pattern Flowchart
  • RAPTOR Editions
  • Flowgorithm Conditional Breakpoint Statement
  • Flowgorithm Read Numbers from File Example
  • Search Text File Flowchart Example
  • Flowgorithm Turtle Graphics Symbols
  • Draw Circle using Flowgorithm Turtle

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version