HexLibraryHexLibrary
</> HexCodeSign inSign up
PythonJavaScriptTypeScriptCC++JavaPHPGoRustRubyBashSQLLuaPerlCOBOLPascalDelphiFortranDartSwiftC#JuliaGroovyRElixirHaskellKotlinScalaClassic ASPClipperMS-DOS
LESSONS
Introduction to FortranVariablesOperatorsConditions (if)Loops (do)ArraysFunctions
REFERENCE
📖 Overview
🖥️ Output
📦 Variables
🔢 Numbers & Math
🔁 Condition & Loop
if / then / elsedo (loop)
📋 Array
🧩 Functions & Subroutines
Fortran›REFERENCE›Condition & Loop›do (loop)

do (loop)

Numeric loop.

Syntax

do i = start, end
  ...
end do

Description

do i = 1, 5 → from 1 to 5 (BOTH inclusive). The third value is the step: do i=0,10,2.

Example

Loading editor…

Expected output

55

When to use?

Summation, array processing, iteration.

Common mistakes

  • ⚠️ do i=1,5 → the final value 5 IS INCLUDED.

Related commands

if / then / else
← if / then / else
HexLibraryHexLibrary

Learn programming more clearly. Every command is explained line by line with colors, reinforced with runnable exercises, test your code instantly — all in one place, free.

Learn

  • Home
  • Languages & Lessons
  • HexCode

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

Other Projects

  • HexToolz
  • Free Service Manuals
© 2026 HexLibrary · The clearest way to learn code