My Fortran Journey
Posted: Wed Jan 21, 2026 8:28 am
Hello everyone!
I am starting to learn Fortran!
I will update this post with milestones I think are important.
For now however, let's start with update #1.
UPDATE #1:
I wrote my first script in Fortran (Well 2nd I think? But Idc)!
I'm using this site...
https://fortran-lang.org/
... to learn Fortran, and this site...
https://dev.lfortran.org/
... to practice.
END OF UPDATE #1
UPDATE #2
I wrote a program showcasing what I've learned of do loops!
END OF UPDATE #2
UPDATE #3
I wrote a "mad libs" style program!
I am starting to learn Fortran!
I will update this post with milestones I think are important.
For now however, let's start with update #1.
UPDATE #1:
I wrote my first script in Fortran (Well 2nd I think? But Idc)!
Code: Select all
program strings
implicit none !Not adding "implicit none" to the beginning of any program written in Fortran is considered bad because it hides a lot of information, causing more errors
character(len=8) :: forum !creates a variable named "forum"
forum = 'T2Oboard' !sets "forum" to "T2Oboard"
print *, 'Hello Fortran!' !Hello Fortran!
print *, forum, 'is awesome!' !T2Oboard is awesome!
end program stringshttps://fortran-lang.org/
... to learn Fortran, and this site...
https://dev.lfortran.org/
... to practice.
END OF UPDATE #1
UPDATE #2
I wrote a program showcasing what I've learned of do loops!
Code: Select all
program say_100_times
implicit none
character(len=50) :: saywhat
integer :: i !declares the integer of how many times the do loop shall repeat; in this case, 100
print *, 'What do you want me to say 100 times? (Character limit: 50)'
read (*,'(A)') saywhat !asks for the string to repeat 100 times
do i = 1, 100 !initializes the do loop and specifies its limit (1-100)
print *, trim(saywhat) !trim(saywhat) removes unnecessary space
end do !ends the do loop, obviously
print *, 'Finished! Exiting...'
end program say_100_timesUPDATE #3
I wrote a "mad libs" style program!
Code: Select all
program story
implicit none
character(len=5) :: w1, w2, w3, w4 !declares our inputs
print *, "Let's write a story! I'll prompt you for some words; type them into the space provided" !some of the print functions here have to be "" instead of '' because using words with apostrophes end the print function early
print *, "and hit enter to finalize your input."
print *, "REMEMBER: You cannot change your choice once you hit enter, so please make sure"
print *, "that you're happy with it."
print *, "Also: you have to type a word with 4-5 letters (To avoid trailing spaces)."
print *, "Ready? Let's begin!"
print *, '' !blank lines for space
print *, '' !blank lines for space
print *, "Enter a word representing onomatopoeia, make sure it's uppercase..."
read(*,*) w1 !this function (and other subsequent functions similar to this) updates our word bank of inputted words
print *, 'Enter a noun...'
read(*,*) w2
print *, 'Enter a verb ending in ed, but do not type the ed...' !this is because the "ed" is already printed at the end
read(*,*) w3
print *, 'Enter a location...'
read(*,*) w4
print *, ''
print *, ''
print *, w1, '! The ', w2, ' ', w3, 'ed through the ', w4, '.' !puts the story together
end program story