My question is, how and which approach would you recommend, when I would have to assign value to a variable that is a bit more complex. Bellow this text, you can see a short example that I have written. Both month and year variables can be assigned in the variables tab, but I am having a hard time finding an approach, where there is more line of logic to implement.
Thanks for all the help!
var month = new Random().Next(1,13);
var year = new Random().Next(DateTime.Now.Year, DateTime.Now.Year + 100);
int_Month - new Random().Next(1,13)- Same idea as you. int_Year - new Random().Next(DateTime.Now.Year, DateTime.Now.Year + 100) - Same idea as you. int_MaxDays - This is the variable that will assume your logic explained above. int_Days - You will receive the value you explained above at the end of the execution.
If(int_Month = 1 Or int_Month = 3 Or int_Month = 5 Or int_Month = 7 Or int_Month = 8 Or int_Month = 10 Or int_Month = 12,
31,
If(int_Month = 2,
If(int_Year Mod 4 = 0 And int_Year Mod 100 = 0 And int_Year Mod 400 = 0,
28,
29
),
30
)
)
You’re welcome, @Rok_Furlan!! If this solved your problem, mark the answer as “solved” that then the topic will be finalized and your doubt may be that of future programmers!! Thank you!