This directory contains a simple Fortran program that prints "GO VOLS!" to the console.
Fortran (FORmula TRANslation) is one of the oldest high-level programming languages. It's particularly suited to numeric computation and scientific computing, and is still used in fields like weather prediction, computational physics, and aerospace engineering.
- Fortran compiler (such as gfortran)
- Install MinGW-w64 from https://mingw-w64.org/doku.php/download
- During installation, make sure to select the Fortran compiler option
- Add the MinGW-w64 bin directory to your system PATH
- Open a new Command Prompt and verify the installation by typing:
gfortran --version
- Install Homebrew if you haven't already: https://brew.sh/
- Open Terminal and install gfortran:
brew install gcc
- Verify the installation:
gfortran --version
On Ubuntu or Debian:
- Open a terminal
- Install gfortran:
sudo apt update sudo apt install gfortran
- Verify the installation:
gfortran --version
- Open a terminal (Command Prompt on Windows, Terminal on macOS/Linux)
- Navigate to the
fortran
directory within thego-vols
project:cd path/to/go-vols/fortran
- Compile the program:
gfortran go_vols.f90 -o go_vols
- Run the compiled program:
- On Windows:
go_vols
- On macOS/Linux:
./go_vols
- On Windows:
You should see "GO VOLS!" printed to the console.
Here's what the go_vols.f90
file contains:
program go_vols
implicit none
print *, "GO VOLS!"
end program go_vols
program go_vols
begins the main program.implicit none
is a best practice that requires all variables to be explicitly declared.print *, "GO VOLS!"
prints "GO VOLS!" to the console.end program go_vols
ends the main program.
Now that you've compiled and run your first Fortran program, you might want to:
- Modify the message it prints
- Learn about Fortran's data types and variables
- Explore Fortran's subroutines and functions
- Understand Fortran's array operations and scientific computing capabilities
While Fortran might seem old-fashioned, it's still widely used in scientific computing due to its performance in numerical computations. Keep exploring its unique features!