%!PS % Draw a series of circles along the diagonal % Changing colors. Tricky! % Illustrates booleans, for loop % Joseph O'Rourke 10 1 0 setrgbcolor % Green 2 setlinewidth /inch {72 mul} def % Place true on the stack if the stack top is an even integer /even { 2 mod 0 eq } def % Change orgin to center of page 4.25 inch 5.5 inch translate % Draw circles on diagonal. % Each is a separate path, and stroked separately. % start incr end 0 10 200 { % Bind counter to i for later use. loop counter is always on top of stack. /i exch def newpath i 10 idiv % Integer divided the counter by 10, for even/odd check even {1 0 0 setrgbcolor} % Red {0 0 1 setrgbcolor} % Blue ifelse i i 20 0 360 arc % (x,y) = (i,i), i.e., on diagonal stroke } for showpage