How to do addition operation

5,880 views
Skip to first unread message

yun li

unread,
May 20, 2011, 6:19:09 AM5/20/11
to robotframe...@googlegroups.com
Hey,

I'm trying to do an addition operation for two variables:

  ${count}=  Set Variable  ${0}+${1}

But the result is ${count} = 0+1, which is not my expectation, I want 0+1=1.

How can I do?  Need to write a .py method?

Jussi Malinen

unread,
May 20, 2011, 6:25:32 AM5/20/11
to liyun...@gmail.com, robotframe...@googlegroups.com
Hi Yun Li!

Normally all variables are just interpreted as string and you get the
result "1 + 2". To actually evaluate the calculation you could do any
of the following:

a) ${count}= Evaluate ${0}+${1}

b) ${count}= Set Variable ${0 + 1}

c) your own python library

Best Regards,
Jussi

> --
> You received this message because you are subscribed to the Google Groups
> "robotframework-users" group.
> To post to this group, send email to robotframe...@googlegroups.com.
> To unsubscribe from this group, send email to
> robotframework-u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/robotframework-users?hl=en.
>

GerhardH

unread,
May 20, 2011, 6:26:19 AM5/20/11
to robotframework-users
Hello,

call keyword Eveluate:

${count}= Evaluate ${0]+${1}

Best regards
Gerhard
Reply all
Reply to author
Forward
0 new messages