Is possible to use formulas question with if and for statements if so anyone can provide me a simple example of the syntax

Basically I need to get a variable and based on the value choose the action to perform.

Is possible to use formulas question with if and for statements if so anyone can provide me a simple example of the syntax

Basically I need to get a variable and based on the value choose the action to perform.

Thanks Dominique. But looking for the possibilities it seem to be impossible to do something like this or i am wrong?

Random variable

Arti={"Hip", "Knee"};

if Arti == 0

X [1,2,3,4,5];

if Arti == 1

X [10,20,30,40,50];

Random variable

Arti={"Hip", "Knee"};

if Arti == 0

X [1,2,3,4,5];

if Arti == 1

X [10,20,30,40,50];

the conditional operator can be used, however, it requires a numerical value.

x = (a==0)?value of true:value if false;

For example:

a=1

b=2

x=(a>b}?3:4;

would result in x =4

I have wanted to use a condition to set a new variable equal to a string.

I do hope this feature will be added in the future.

x = (a==0)?value of true:value if false;

For example:

a=1

b=2

x=(a>b}?3:4;

would result in x =4

I have wanted to use a condition to set a new variable equal to a string.

I do hope this feature will be added in the future.

Hello Wendy,

To set a new variable equal to a string, just add a line as follows:

a=1; b=2; x=(a>b)?0:1; newvariable=pick(x,"String 1","String 2");

Thank you!! This will help.

Hello Jorge,

On the contrary, it is very easy to do.

Define a random variable equal to 0 or 1:

a = {0,1};

Define global variables as follows:

Arti = pick(a,"Hip","Knee"); A = [1,2,3,4,5]; B = [10,20,30,40,50]; X = pick(a,A,B);