- #1
fluidistic
Gold Member
- 3,923
- 261
Hey guys,
I've read that Borek (a member here) was told that the goto statement was "bad" during the 80's. I myself did some research on the Internet about that and it seems that:
1)Fortran used to have the goto statement up till Fortran 90.
2)It has been eradicated since Fortran 95.
3)In wikipedia one reads
And also, how would you modify this part of one of my codes:
It seems so intuitive and efficient that I'm really curious what's "bad" about it and what would be the "correct" version according to nowadays programmers.
Thanks a bunch in advance! (I'm really eager to know!)
I've read that Borek (a member here) was told that the goto statement was "bad" during the 80's. I myself did some research on the Internet about that and it seems that:
1)Fortran used to have the goto statement up till Fortran 90.
2)It has been eradicated since Fortran 95.
3)In wikipedia one reads
I'd like to know why it is considered as "bad" to use the goto statement, particularly in Fortran but I wouldn't mind if someone reply for another language.The 1960s and 1970s saw computer scientists move away from GOTO statements in favor of the "structured programming" paradigm.
And also, how would you modify this part of one of my codes:
Code:
98 write(*,*)"In order to solve the linear system, do you want to use Jacobi(1)'s method or Gauss-Seidel(2)'s one?"
read(*,*)p
if (p==1) then
call jacobi(n_max,n,tol)
else if (p==2) then
call gauss(n_max,n,tol)
else
write(*,*)"Please choose a valid option"
goto 98
end if
Thanks a bunch in advance! (I'm really eager to know!)