(view source code of leapyear.rex as plain text)
/* LeapYear.rex *//* Check if the specified year is a leap year *//* Written by Rob van der Woude *//* http://www.robvanderwoude.com */parse arg year dummy .
if dummy <> "" then call Syntax
if year <> "" then do
if pos( "?", year ) > 0 then call Syntax
if year < 0 then call Syntax
if year > 9999 then call Syntax
endelse do
year = substr( date("S"), 1, 4 )
endleapyear = 0
if year // 4 = 0 then leapyear = 1
if year // 100 = 0 then leapyear = 0
if year // 400 = 0 then leapyear = 1
if leapyear = 1 then do
msg = year||" IS "
endelse do
msg = year||" is NOT "
endmsg = msg||"a leap year"
saysay msgexit 0
Syntax:
saysay "LeapYear.rex, Version 1.00"
say "Check if the specified year is a leap year"
saysay "Usage: <REXX> LEAPYEAR.REX [ year ]"
saysay 'Where: "<REXX>" is your Rexx interpreter:'
say " - Windows: REGINA.EXE or REXX.EXE, whichever you installed"
say " - OS/2: no need to specify, just rename script to *.cmd"
say ' "year" is any year between 0 and 9999'
saysay "Written by Rob van der Woude"
say "http://www.robvanderwoude.com"
exit 1
returnpage last modified: 2025-10-11; loaded in 0.0073 seconds