BruceJohnJennerLawso
Programmer
Hello all
So I am working on some basic Fortran (FORTRAN) programs in order to learn the basics. I have some experience coding in C++ before this
Im trying to write some basic input control structures, ie
But when I go to compile it with gfortran (ahh, gfortran -o menu menu.f)
I get
Which I dont understand, since I thought == was a comparison operator, not the assignment one. Is it absolutely necessary to declare another character string , assign 'P' or 'p' to it, and check it in that case?
So I am working on some basic Fortran (FORTRAN) programs in order to learn the basics. I have some experience coding in C++ before this
Im trying to write some basic input control structures, ie
Code:
PROGRAM MENU
implicit none
character (LEN=5):: input
write(*,*)'==Age Database=='
do while(input/='Q'.or.input/='q')
write(*,*)'==Main Menu=='
write(*,*)'> '
read(*,*)input
if(input=='P'.or.input=='p')
write(*,*)'P command activated'
end if
end do
stop
end program MENU
But when I go to compile it with gfortran (ahh, gfortran -o menu menu.f)
I get
gfortran said:menu.f:9.72:
if(input=='P'.or.input=='p')
1
Error: Cannot assign to a named constant at (1)
menu.f:11.11:
end if
1
Error: Expecting END DO statement at (1)
Which I dont understand, since I thought == was a comparison operator, not the assignment one. Is it absolutely necessary to declare another character string , assign 'P' or 'p' to it, and check it in that case?