Writing the random variable

Hello guys!

I’m using the command:

Assign
Greentings = {“Hi”, “Hello There!”, “Hello”}

and then I use

Assign
RandomIndex = New Random().Next(0,10)

And then, when I’ll write this greetings I’m using the command “Greentings(RandomIndex)” on the Type Into.

I’m need write this information in write line, but, how that I can write this random variable? That was be used on this field?

Hi @arthurfsantos11

I dont understand very well what you need. Are you asking about to check the random value of RandomIndex??? just put in a writeline: RandomIndex.ToString and you will get the Index number

Is that what you need? Sorry if I missunderstood

Hello,
The solution for your problem.
random.xaml (5.6 KB)
:slightly_smiling_face:

1 Like

Thanks!

Hey @arthurfsantos11

you have to generate number bettwen 0 to your array size to get access to your array elements otherwise you will get outofindex error.

hey @Pablo_Sanchez

Actually it might be for a chat client or so so every time it will return a random response on Greeting so end user won’t feel like bot is returning a hard coded reply :slight_smile: or response :slight_smile:

Regards…!!
Aksh