saurabh baid
saurabh baid

Reputation: 1877

In Robot Framwork how to set value of variable based on some condition

If there is a variable ${var} I want to set its value to 0 if its current value is None otherwise leave the current value unchanged. I understand it should be very easy but some how I am having trouble in verifying the recipe.

Upvotes: 1

Views: 98

Answers (2)

Rakesh
Rakesh

Reputation: 1575

You can use the keyword Set Variable If

 ${Var}=    Set Variable If   '${Current_Value}'=='None'     0    ${Current_Value}

Upvotes: -2

Bryan Oakley
Bryan Oakley

Reputation: 385970

You can use Set variable if, and give the current value as the second value:

${var}=  Set variable if  $var is None  0  ${var}

Upvotes: 3

Related Questions