For While do loop activity

Hello Everyone,
I am new in UiPath. I taken one input dialog & taken number 10 and I want to do print in write line as a output 12345678910 using while do loop. Please help

Hi @Nadim_Hossain

=> Use Input Dialog Box acitvity

Dialog Title: "Enter a number"
Input Label: "Please enter the number"
Input Type: Text Box
Value Entered: create a veriable usserInput

=> Use below syntax in Assign activity:

Assign -> counter = 1
Assign -> resultString = ""

=> Use While loop and give below condition:

While
 counter <= CInt(userInput)
   Assign -> resultString = resultString+counter.ToString
   Assign -> counter = counter + 1
End While

=> Outside While loop use Write Line to print resultString.
Ouptut:
image

Flow:

Variable DataTypes:

Xaml:
Sequence33.xaml (9.1 KB)

Regards

1 Like

@Nadim_Hossain

Welcome to the community

Just drag a while activity…

In max iteration property provide 10

In the index property provide a variable int_counter

Inside loop use assign with str_finalValue = str_finalValue +(int_counter+1).ToString

Thsi way no counter is needed and no invrementing is needed

Cheers

@Nadim_Hossain,

Welcome to the UiPath Community :tada:

You should be getting trained on this buddy. It’ very much basic.

Good luck :v:

Thanks,
Ashok :slight_smile:

Dear @vrdabberu thank you very much for giving solution with clear step with xaml file. But I am confused about 2 issue:

  1. Why usserInput variable type is string where I input only number
  2. In Condition (counter <= CInt(userInput)) What is meaning of CInt?

Hi @Nadim_Hossain

  1. Input Dialog output datatype is System.String
  2. Since we have taken a cojnter we are converting the userInput variable from string to integer datatype to match the condition.

Regards

@vrdabberu Thanks got it

1 Like

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