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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.