Example Using @CAL: MAPPER

This example MAPPER RUN primarily uses the @CAL (Calculate) statement to perform the "ninety-nine bottles of beer" countdown. The MAPPER code also duplicates lines in a result with @LNX and finds and replaces phrases in a result using @LCH.

MAPPER

.bottles of beer
*===============================================================================
@brk .
*
*===============================================================================
     bottles of beer on the wall,      bottles of beer,
Take 1 down, pass it around,      bottles of beer on the wall.
@brk lnx,-0,4,99,2 .
@cal,-0 t 2-3,35-3 ,a,a a=101-line .
@cal,-0 t 30-3 t,a a=100-line .
@lch,-0 afmt$ 2-79 ' 1 bottles'/' 1 bottle' .
@lch,-0 afmt$ 2-79 ' 0 bottles'/'no more bottles' dsx,-0 .