xref: /freebsd/contrib/bc/tests/bc/scripts/ifs.bc (revision a30efc5ca7272e446abb71f0d72c76539f267bb6)
1#! /usr/bin/bc -q
2
3a = 1
4b = 2
5c = 3
6
7if (a == 1) if (b == 2) if (c == 3) print "Yay!\n"
8
9define void g(x) {
10	print "g: x: ", x, "\n"
11}
12
13if (a == 1) {
14	if (b == 2) {
15		if (c == 3) {
16			g(5)
17		}
18	}
19}
20
21define void h(x) {
22	print "h: x: ", x, "\n"
23}
24
25if (z == 0)
26	for (i = 0; i < 2; ++i)
27		if (a == 1)
28			for (j = 0; j < 2; ++j)
29				if (b == 2)
30					for (k = 0; k < 2; ++k)
31						if (c == 3) h(k)
32
33define void i(x) {
34	print "i: x: ", x, "\n"
35}
36
37if (z == 0) {
38	for (i = 0; i < 2; ++i) {
39		if (a == 1) {
40			for (j = 0; j < 2; ++j) {
41				if (b == 2) {
42					for (k = 0; k < 2; ++k) {
43						if (c == 3) i(k)
44					}
45				}
46			}
47		}
48	}
49}
50