Incorrect/incomplete leap year calculation in RPA Developer Foundation

Lesson 2, Code Flow
Your example for calculating leap years is incomplete. Not every year divisible by 4 is a leap year.

Every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100, but these centurial years are leap years if they are exactly divisible by 400. For example, the years 1700, 1800, and 1900 are not leap years, but the year 2000 is.

Maybe a simple if odd/even test will suffice to introduce the if/else constructs.

Hi @korygill,
Use if condition
year mod 4 <> 0
True-> leap year
False-> not an leap year.

Arivu :slight_smile:

No @arivu96 if condition should be like

((year mod 4 = 0) and (year mod 100 <>0)) or (year mod 400 = 0)
True ----> Leap Year
False -----> Not a Leap Year

But this example wrongly calculating leap year in Lesson 2 Example of Level 1 Foundation course in Uipath Acadamy

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.