Assign Function

I’m having trouble understanding what the assign function is about. I do not understand what is the purpose of putting a +1 in front of the variable.

Welcome to the forum

its increasing the counter by one, where intIndex is counting the loops

1 Like


For the first instance intIndex will be number based on assigned default value

It will add the assigned value +1 as long as the intindex will be satisfy the condition!


1 Like

In this code it increments intindex by 1 each time (I assume it started at 0) so that after the While loop has run 5 times it will exit the loop.

1 Like


You are using a while loop with a condition

Like this
Intsize<40 and intindex<5

If you run the process without increment the variable intinidex then the loop will keep on running for infinite time

Only if you increase the value of intindex for every run that value will increase and once after meeting a condition like
5<5, loop will break and comes out of while loop

So to break the loop we need to increase the value of the variable used in condition

To increase the value we are keeping + 1


1 Like