Get the numbers from 1 to 10 and from 10 to 1

Hello dear community !!!
My name is Cezar, and I am currently learning for the RPA Developper certificate and this is the first time I post a question here :smiley:

I am trying to solve a challenge I received: to display the numbers from 1 to 10 and from 10 to 1.

I used Do While 2 times and at the end I want to display both arrays in enumerable form:
String.Join(", β€œ, ListDescNumber).ToArray + Environment.NewLine +
String.Join(”, ", ListAscNumber).ToArray
As you can see in the logs below, for any reason ever the first array goes until 0, while I expect to end at 1
and the 2nd array goes until 11, while I expect to stop at 10.

Can you please help me to understand what I do wrong?
I can’t attach the sequence, so I tried to put the whole sequence as an imange

02/05/2020 11:30:34 => [Debug] Debug started for file: Challenge IP6
02/05/2020 11:30:36 => [Info] Challenge IP6 execution started
02/05/2020 11:30:51 => [Info] 1
02/05/2020 11:30:51 => [Info] 2
02/05/2020 11:30:51 => [Info] 3
02/05/2020 11:30:51 => [Info] 4
02/05/2020 11:30:51 => [Info] 5
02/05/2020 11:30:51 => [Info] 6
02/05/2020 11:30:51 => [Info] 7
02/05/2020 11:30:51 => [Info] 8
02/05/2020 11:30:51 => [Info] 9
02/05/2020 11:30:51 => [Info] 10
02/05/2020 11:30:51 => [Info] 10
02/05/2020 11:30:52 => [Info] 9
02/05/2020 11:30:52 => [Info] 8
02/05/2020 11:30:52 => [Info] 7
02/05/2020 11:30:52 => [Info] 6
02/05/2020 11:30:52 => [Info] 5
02/05/2020 11:30:52 => [Info] 4
02/05/2020 11:30:52 => [Info] 3
02/05/2020 11:30:52 => [Info] 2
02/05/2020 11:30:52 => [Info] 1
02/05/2020 11:30:52 => [Info] 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
02/05/2020 11:30:52 => [Info] Challenge IP6 execution ended in: 00:00:16

can you share your workflow?

Hi @Cardon_Cezar

On close observation, I believe you have used while loop for Descending which is not similar to Do while loop. While loop will check for condition first and later it will execute. you can change the condition as StarDesc > iteration or use do while loop. Hope that will work.

I would love to. Unfortunately new users are not allowed to upload attachments. Do you know how I can bypass this restriction?

If you give me an email address I can send it to you there.

Check this out is it your requirement
Flowchart3.xaml (12.5 KB)

1 Like

Thank you very much for your time and for the solution.

Most Welcome

Happy Automation!

1 Like

Why you used the condition inside While count1 < 9. It’s correct, however I was sure it should be count1 <= 9

As we already added first one (1)=1
Then we start counter from 0
so from 0 to less than 9 {0,1,2,3,4,5,6,7,8}=9
So overall:= 1+9=10

1 Like

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