Different variables in protected fields
Posted: February 4th, 2016, 3:48 am
Hi CSPro users,
I want to create 2 random variables X and Y and they should be different (X <> Y). I tried the next code :
numeric X;
numeric Y;
X = random (1,10);
Do Y = random (1,10) until Y <> X;
enddo;
I also tried that
numeric X;
numeric Y;
X = random (1,10);
Y= 0;
While X <> Y do Y = random(1,10);
enddo
However, it did not work. Could you please help me and correct the code.
Note : X and Y are protected fields. Therefore, I did not use the "reenter" function.
Thanks everyone.
I want to create 2 random variables X and Y and they should be different (X <> Y). I tried the next code :
numeric X;
numeric Y;
X = random (1,10);
Do Y = random (1,10) until Y <> X;
enddo;
I also tried that
numeric X;
numeric Y;
X = random (1,10);
Y= 0;
While X <> Y do Y = random(1,10);
enddo
However, it did not work. Could you please help me and correct the code.
Note : X and Y are protected fields. Therefore, I did not use the "reenter" function.
Thanks everyone.