1

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.

2 Answers 2

3

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

${var}=  Set variable if  $var is None  0  ${var}
Sign up to request clarification or add additional context in comments.

Comments

-2

You can use the keyword Set Variable If

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

1 Comment

This does the same thing whether the current value is the string "None" or the value is the python value None. I think the OP only wants to set the variable if the current value is the python value None.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.