bot.body.create_keyword('Create List', args=['a', 'b', 'c'], assign=['@{list}'])
bot.body.create_for(flavor='IN', variables=['${x}'], values=['@{list}'])
bot.body.create_keyword('log', args=['${x}'])
an example which yielded undesired results. I was hoping that it would have run log 3 times but it just logs latest value of x which is c. I am trying to make some complex examples with these like a nested if, and a for loop that reads x variables in a list until all of x is captured and validate each x with if statement against a condition. A while loop would have been good but I guess a for if would work.
how to do if statement like this example with create if ?
bot.body.create_keyword('Create List', args=['a', 'b', 'c'], assign=['@{list}'])
for_kw = bot.body.create_for(flavor='IN', variables=['${x}'], values=['@{list}'])
for_kw.body.create_keyword(if list[x] == 'b':
log list[x] (or do any other keyword)
elif list[x] == 'c':
log list[x]
else:
end for loop)
There is an extension to this to when we do not know the number of items in the list. how to code this with keywords -
run loop, pick up items from a file and add to a list, until no items to pick up