Menu Close

Statements and Blocks | Fortran

In Fortran, a statement is a unit of code that performs a specific task. Statements are typically terminated with a semicolon (;) or, in the case of a statement that spans multiple lines, with the END keyword.

A block is a group of statements that are executed together as a unit. Blocks are typically defined using the PROGRAM and END keywords, with the block of code being placed between these keywords.

PROGRAM HELLO
PRINT *, "Hello, World!"
PRINT *, "This is a Fortran program."
END PROGRAM HELLO

In this example, the block of code consists of two print statements that are executed when the program is run.

More Related Stuff