4.5: Continuation Lines
- Page ID
- 54252
A statement must start on a new line. If a statement is too long to fit on a line, it can be continued on the next line with an ampersand ('&'). Even shorter lines can be split and continued on multiple lines for more readable formatting.
For example,
A = 174.5 * year & + count / 100.0
Is equivalent to the following
A = 174.5 * year + count / 100.0
Note that the '&' is not part of the statement.
Example
The following trivial program illustrates the program formatting requirements and variable declarations.
! Example Program program example1 implicit none integer :: radius, diameter integer :: height=100, width=150 real :: area, perimeter real :: length = 123.5, distance=413.761 real, parameter :: pi = 3.14159 character(11) :: msg = "Hello World" write (*,*) "Greeting: ", msg end program example1
In this example, a series of variables are defined (as examples) with most not used. The program will display Greeting: Hello World
when executed. The following chapters will address how to use the variables to perform calculations and display results. Additional information regarding character variables is provided in chapter 11.