|
|
1.1 root 1: # This program contains samples of all the basic syntactic
2: # forms in Icon.
3:
4: record three(x,y,z)
5: record zero()
6: record one(z)
7:
8: global line, count
9: procedure expressions()
10: local x,y,z
11: static e1
12: initial e1 := 0
13: ()
14: {}
15: ();()
16: []
17: [,]
18: x.y
19: x[i]
20: x[i:j]
21: x[i+:j]
22: x[i-:j]
23: (,,,)
24: x(,,,)
25: not x
26: |x
27: !x
28: *x
29: +x
30: -x
31: .x
32: /x
33: =x
34: ?x
35: \x
36: ~x
37: @x
38: ^x
39: x \ i
40: x @ y
41: i ^ j
42: i * j
43: i / j
44: i % j
45: c1 ** c2
46: i + j
47: i - j
48: c1 ++ c2
49: c1 -- c2
50: s1 || s2
51: a1 ||| a2
52: i < j
53: i <= j
54: i = j
55: i >= j
56: i > j
57: i ~= j
58: s1 << s2
59: s1 == s2
60: s1 >>= s2
61: s1 >> s2
62: s1 ~== s2
63: x === y
64: x ~=== y
65: x | y
66: i to j
67: i to j by k
68: x := y
69: x <- y
70: x :=: y
71: x <-> y
72: i +:= j
73: i -:= j
74: i *:= j
75: i /:= j
76: i %:= j
77: i ^:= j
78: i <:= j
79: i <=:= j
80: i =:= j
81: i >=:= j
82: i ~=:= j
83: c1 ++:= c2
84: c1 --:= c2
85: c1 **:= c2
86: s1 ||:= s2
87: s1 <<:= s2
88: s1 <<=:= s2
89: s1 ==:= s2
90: s1 >>=:= s2
91: s1 >>:= s2
92: s1 ~==:= s2
93: s1 ?:= s2
94: a1 |||:= a2
95: x ===:= y
96: x ~===:= y
97: x &:= y
98: x @:= y
99: s ? x
100: x & y
101: create x
102: return
103: return x
104: suspend x
105: fail
106: while e1 do break
107: while e1 do break e2
108: while e1 do next
109: case e of {
110: x: fail
111: (i > j) | 1 : return
112: }
113: case size(s) of {
114: 1: 1
115: default: fail
116: }
117: if e1 then e2
118: if e1 then e2 else e3
119: repeat e
120: while e1
121: while e1 do e2
122: until e1
123: until e1 do e2
124: every e1
125: every e1 do e2
126: x
127: X_
128: &cset
129: &null
130: "abc"
131: 'abc'
132: "\n"
133: "^a"
134: "\001"
135: "\x01"
136: 1
137: 999999
138: 36ra1
139: 3.5
140: 2.5e4
141: 4e-10
142: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.