MarketSquare / robotframework-style-guide

Robot Framework Style Guide

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Evaluation Namespace - $var vs '${var}'

manykarim opened this issue · comments

Will you also touch topics like the Evaluation Namespace, e.g. in IF conditions?

e.g. When to use
'${x}' == 'expected'
or
$x == 'expected'

I guess that in such expressions the $x == 'expected' syntax should be used, as it preserves types and allows you to strictly use values as such.

Maybe it is not as error-prone as converting everything to str (as is done when using quotation marks) but it forces you to think in advance about types of variables you use, compare and evaluate. Also, it feels more natural (sorry for non-technical description) to use this syntax as $x is anyway evaluated by Python, so it is more straightforward to use python-like object than to convert everything in advance to string and then evaluate.

But of course It’s only an opinion and I’m not even a contributor to this repo at this point. Just found out about it and looked through „Issues” tab.