xref: /openbsd/regress/usr.sbin/btrace/if.bt (revision ca41b749)
1BEGIN {
2	if (0)
3		printf("nothing");
4
5	@var = 0;
6	if (@var)
7		printf("not printed\n");
8
9	if (1) {
10		printf("printed!\n");
11	}
12
13	if (0)
14		printf("simple if\n");
15	else
16		printf("simple else\n");
17
18	if (0) {
19		printf("disabled if\n");
20	} else if (1) {
21		printf("multiple statements in ");
22		printf("else-if branch\n");
23	} else {
24		printf("no else\n");
25	}
26}
27
28END {
29	if (42) {
30		printf("multiple ");
31		@var = 4;
32		printf("(%d) ", @var);
33		printf("statements\n");
34	}
35
36	if (0) printf("single-line if\n"); else printf("single-line else\n");
37
38	if (0) {
39		printf("not printed\n");
40	} else {
41		if (0) {
42			printf("nested not printed\n");
43		} else {
44			printf("nested printed\n");
45			exit();
46			printf("nested not printed\n");
47		}
48		printf("also not printed\n");
49	}
50}
51