*** Test Cases *** FOR循环1 ${list} create list a b c d FOR ${a} IN ${list} log to console ${a} END LOG TO CONSOLE 循环体外面 结果: ['a', 'b', 'c', 'd'] 循环体外面
*** Test Cases ***
FOR循环2
${list} create list a b c d
FOR ${a} IN @{list}
log to console ${a}
END
LOG TO CONSOLE 循环体外面
结果:
a
b
c
d
循环体外面
注意:FOR循环1和FOR循环2中 ${list}和@{list}的区别,注意FOR大写,END大写
FOR *** IN RANGE *** 的用法,这里FOR和INRANGE都需要大写
*** Test Cases *** FOR循环3 FOR ${a} INRANGE 3 log to console ${a} END LOG TO CONSOLE 循环体外面 结果: 0 1 2