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 break Statement

Overview

In this tutorial, we will learn about the Octave break Statement. We can use the break statement within the body of a loop.

Octave break statement

The break statement jumps the control out of the innermost loop that encloses the statement.

When Octave encounters the break statement, it breaks out of the loop. The statement that is immediately after the loop will be executed. We can use this statement in the loop to check special conditions and can skip the loop altogether.

Example

% Break Statement Demo 
% Octave Tutorials - www.TestingDocs.com

i = 0;

while (true) 

disp(i);

i++;

if (i > 5) 

 break; % Quit the loop if i > 5

endif

endwhile

 

Output

>> breakDemo

0
1
2
3
4
5

In the example, the break statement is used to quit the loop when the variable is greater than 5.

Octave Break Statement

 

To skip the current iteration of the loop, we can use the continue statement.

https://www.testingdocs.com/octave-continue-statement/

—

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 for Statement› Octave continue Statement

Recent Posts

  • MS Access Data Types
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version