robotframework-style-guide icon indicating copy to clipboard operation
robotframework-style-guide copied to clipboard

Consider how to create variables in user keywords eg. VAR, @{var}, &{var}

Open GerwinLaagland opened this issue 1 year ago • 0 comments

When creating keywords there are currently quite a lot of different ways to create variables.

In a variable section, to create a variable, a list, or a dictionary we use the following:

${var}    Variable
@{list}   1    2    3   4
&{dict}   key=value    solution=user

In user keywords there are now (with equals, because why not..

${dct}=     Create Dictionary      vs         &{dct}=     Create Dictionary
${lst}=     Create List            vs         @{lst}=      Create List  
${var}=     Set Variable

But we also have syntax VAR. and that changes things as well:

VAR    @{lst}
VAR    ${scalar}
VAR    &{dict}

Some guideline with this might be good.

GerwinLaagland avatar Mar 01 '24 16:03 GerwinLaagland