Problems with Leap Year activity (Level 1 Lesson 2 Control Flow)

I am working through the Control Flow activities exactly as presented in the Ui Path Foundation Training. I am having trouble using the following condition as part of a Do While loop: ‘year mod <> 0’. I have defined the ‘year’ variable as an integer but I can’t even run the flow as I keep getting an error 'Compile error(s) encountered processing expression “year mod <> 0”. XML name expected.

As mentioned, I am following the steps EXACTLY as done in the training and so very frustrated that I am wasting my time trying to figure this out. I saw posts on this from a year ago but never saw a solution, I’ve uploaded a screen grab that shows the error along with the definition of the ‘year’ variable. I’m sure someone is going to say it’s a problem with the flow/logic but I don’t think that’s the problem. Appreciate any help from someone that figured this out. Thanks!.

@davidSSSUi, Seems you are missing out an Divisor.

Eg : Condition should be year mod 4 <> 0

Regards,
Dom :slight_smile:

1 Like

Hi Dom,

What is a Divisor? And how to fix it if it is missing? We are following the tutorial? So why does the video not have this issue but we are facing it?

Best regards,
Shimin

The divisor is the 4 that is not being entered, the original poster did not include year mod 4 <> 0 which threw the error.

Regards,
Alex

Hi
You can use DateTime in build function as below and get result in Boolean.

int inYear = 2000

DateTime.IsLeapYear(inYear)

Dear expert out there, i’m attending the foundation currently at course Lesson 2: Creating a leap year. When i follow the instructor method, i’m getting error " Compiler error(s) encountered processing expression “year mode 4 = 0”.
End of expression expected.

Try the following condition:
a) year mode 4 = 0
b) year mod 4 <> 0 (Compiler error(s) encountered processing expression “year mod 4 <> 0”.
Argument not specified for parameter ‘DateValue’ of ‘Public Function Year(DateValue As Date) As Integer’.)

Unable to proceed to next course.

Please help.

Another screenshot for your reference:

Hi @itfirsttech

Your year variable neesd to be an Integer for this to work. It is most likely a DateTime variable, given your error message.

I recalled that i have change from String to Integer but still facing the same error, No worry as of now because i have download the instructor lesson file as future reference. Thank you.

1 Like

I have faced the same issue and resolved with below points.Try it out.

  1. year data type int32.
    2.I have changed the scope of variable year to sequence.