syntax error with <> in if statement
bouabdellah abed
bouabdellah.abed@univ-usto.dz
Fri Jun 19 11:29:58 GMT 2020
Dear developers
First and foremost, I *hope you* are *staying healthy* and safe during this
difficult time.
Can you verify this error that appears in this program :
PROGRAM EX1
IMPLICIT NONE
INTEGER X , J
PRINT *, 'PROGRAM PRINT EVEN OR ODD NUMBERS BETWEEN 1 - 20'
PRINT *, ' '
DO X = 1, 20
J = MOD(X, 2); ! REMAINDER OF X / 2
!IF ( J <> 1 ) THEN ! WHEN USING, IT PRODUCES SYNTAX ERROR --> ERROR :
EXEPECTIONG END DO STATATEMENT
IF ( J .NE. 0 ) THEN ! 0 FOR EVEN NUMBERS ; 1 FOR ODD NUMBERS
CYCLE ! SKIP TO NEXT NUMBER
END IF
PRINT *, X
END DO
PRINT *,' '
END
when i use cycle in the IF statement with <>
IF (i <> 1) THEN
rather than .N E.
IF (i .ne. 1) THEN
that’s produces this error:
Syntax error in expression
Error: Expecting END DO statement
I’m using:
system : ubuntu 20.04 LTS
compiler: GNU Fortran (Ubuntu 7.5.0-3ubuntu1 ~ 18.04) 7.5.0
on : Code :: Blocks 16.01! rev 10692
thank you.
More information about the Fortran
mailing list