How to create a scalar variable, empty variable, List variable, Dictionary Variable in a robot framework?

Variables in the robot framework are case-insensitive, Spaces, and underscore are ignored.

example : ${Var 1}, ${var 1}, ${Var_1}, ${var_1}. All these variables represent one variable.

Creating Scalar Variables in Robot Framework.

The symbol “$” is used to declare a scalar variable in the Robot Framework. The variable name will be present inside {} open curly braces and closing curly braces.

example : ${var1}

Creating List Variable in Robot Framework.

The symbol “@” is used to define list variables in the robot framework. Lists can be created as follows:

${List} = Create List

List with some values.

@{List} 10 20 30 40 50

${List} = Create List 10 20 30 40

Creating empty list variables.

@{List} @{EMPTY}

${List} = Create List

example : @{list}

example : ${Var 1}

Creating dictionary variables in robot framework.

The symbol “&” is utilized to indicate dictionary variables in the robot framework. In the dictionary, each item is present in key-value pair, where the key describes the value.

example : &{dict}

Dictionary with some values.

example : ${dict} Create Dictionary name=ram age=19 subject=PCM

example : &{dict} name=ram age=19 subject=PCM

Empty dictionary in robot framework.

example : &{dict} &{EMPTY}

example : ${dict} Create Dictionary

2 thoughts on “How to create a scalar variable, empty variable, List variable, Dictionary Variable in a robot framework?”

Leave a Comment

Your email address will not be published.