Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!portal!cup.portal.com!R_Tim_Coslet From: R_Tim_Coslet@cup.portal.com Newsgroups: comp.lang.pascal Subject: Re: Day-of-week algorithm, please! Message-ID: <17209@cup.portal.com> Date: 15 Apr 89 14:20:27 GMT References: <19040@adm.BRL.MIL> <1780001@hpcc01.HP.COM> <2394@maccs.McMaster.CA> <1265@rpi.edu> Organization: The Portal System (TM) Lines: 26 In article: <1265@rpi.edu> mketch@pawl.rpi.edu (Michael D. Ketchen) gave the following Pascal function for leap year determination... > >function IsALeap (year: integer): boolean; >(* returns TRUE if 'year' is a leap year *) >begin > IsALeap:=FALSE; > if ((year mod 4)=0) and ((year mod 100)<>0) > or ((year mod 400)=0) then > IsALeap:=TRUE >end; (* IsALeap *) > It would be simpler to write like this... function IsALeap (year: integer): boolean; (* returns TRUE if 'year' is a leap year *) begin IsALeap := ((year mod 4)=0) and ((year mod 100)<>0) or ((year mod 400)=0) end; (* IsALeap *) R. Tim Coslet Usenet: R_Tim_Coslet@cup.portal.com BIX: r.tim_coslet