I need to code a very basic fortran program that takes command line input, and I'd like to terminate the program if I detect wrong input. The following doesn't work:

if (n .NE. 5) then
	write (*,*) "Wrong number of arguments"
	end program Poker
end if

I get "Error: Expecting END IF statement at (1)", where (1) is at "end program Poker", which makes sense, but I have no idea how to jump to "end program" then. I'd rather not enclose the whole program in an if-statement, so if there's any other way, I'd appreciate it a lot if someone could point me in the right direction.

Edited by levinia-heks: n/a

6 Years
Discussion Span
Last Post by levinia-heks
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.