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

Variable (integer / real)

Typed variable declaration.

Syntax

integer :: name
real :: name

Description

Variables are declared at the beginning of the program, BEFORE executable lines. integer is whole number, real is decimal, character is text. implicit none is a good habit.

Example

Loading editor…

Expected output

36   1.72

When to use?

Storing all kinds of data.

Common mistakes

  • ⚠️ Declarations must be at the beginning of the code; new variables cannot be defined in between.

Related commands

parameter (constant)
parameter (constant) →
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