qse/ase/test/awk/simple-004.awk

29 lines
372 B
Awk
Raw Normal View History

2007-12-07 23:58:44 +00:00
function error() { exit (200); }
function getx()
{
if (x == 2) error();
return x++;
}
function gety() { return y++; }
BEGIN {
x = 0;
y = 0;
print getx() + gety();
print getx() + gety();
print getx() + gety();
print getx() + gety();
}
END {
print "END OF PROGRAM";
exit (20);
}
END {
print "END OF PROGRAM 2";
}