File: preprocessor11.f90

package info (click to toggle)
lfortran 0.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 46,332 kB
  • sloc: cpp: 137,068; f90: 51,260; python: 6,444; ansic: 4,277; yacc: 2,285; fortran: 806; sh: 524; makefile: 30; javascript: 15
file content (125 lines) | stat: -rw-r--r-- 1,766 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
program preprocessor11
! #if with >, <, ==
implicit none

#define X 1
#define Y 5
#define Z 1+Y*3

print *, Z

#if X == 1
print *, "X is 1"
#else
print *, "X is not 1"
#endif

#if X == 2
print *, "X is 2"
#else
print *, "X is not 2"
#endif

#if X != 1
print *, "X is not 1"
#else
print *, "Not X is not 1"
#endif

#if X == 1 && Y == 5
print *, "X is 1 and Y is 5"
#else
print *, "Not (X is 1 and Y is 5)"
#endif

#if X == 2 && Y == 5
print *, "X is 2 and Y is 5"
#else
print *, "Not (X is 2 and Y is 5)"
#endif

#if X < 3 && Y > 3
print *, "X<3 and Y>3"
#else
print *, "Not (X<3 and Y>3)"
#endif

#if X > 3 && Y < 3
print *, "X>3 and Y<3"
#else
print *, "Not (X>3 and Y<3)"
#endif

#if X == 3-2
print *, "X is 3-2"
#else
print *, "X is not 3-2"
#endif

#if X == 3-1
print *, "X is 3-1"
#else
print *, "X is not 3-1"
#endif

#if Y == (6*5-5)/5
print *, "Y is (6*5-5)/5"
#else
print *, "Y is not (6*5-5)/5"
#endif

#if Y == (6*5-6)/5
print *, "Y is (6*5-6)/5"
#else
print *, "Y is not (6*5-6)/5"
#endif

#if Y == (-5+6*5)/5
print *, "Y is (-5+6*5)/5"
#else
print *, "Y is not (-5+6*5)/5"
#endif

#if Y == (-6+6*5)/5
print *, "Y is (-6+6*5)/5"
#else
print *, "Y is not (-6+6*5)/5"
#endif

#if Y == (+5+6*5)/7
print *, "Y is (+5+6*5)/7"
#else
print *, "Y is not (+5+6*5)/7"
#endif

#if Y == (+4+6*5)/7
print *, "Y is (+4+6*5)/7"
#else
print *, "Y is not (+4+6*5)/7"
#endif

#if Y == (+5+6*Y)/7
print *, "Y is (+5+6*Y)/7"
#else
print *, "Y is not (+5+6*Y)/7"
#endif

#if Z == 16
print *, "Z is 16"
#else
print *, "Z is not 16"
#endif

#if defined(Y) && (3 <= Y)
print *, "Y defined and 1 <= Y"
#else
print *, "Y not defined or not 1 <= Y"
#endif

#if defined(A) && (3 <= A)
print *, "A defined and 1 <= A"
#else
print *, "A not defined or not 1 <= A"
#endif

end program