我收到错误
'Else'是保留关键字
代码snipet如下,任何人都可以指导我的解决方案吗?
:FOR ${key} IN @{keys}
\ ${item}= Get From Dictionary ${services} ${key}
\ Run Keyword If '${item}' == '1' Log Service: ${key} is Running
\ Else If '${item}' == '2' Log
\ ... Service: ${key} is not running
答案 0 :(得分:1)
您忘记使用延续字符。所有"其他"和" elseif"单词,以及其他关键字和参数,必须都是" run关键字的参数,如果"关键字。
:FOR ${key} IN @{keys}
\ ${item}= Get From Dictionary ${services} ${key}
\ Run Keyword If '${item}' == '1'
\ ... Log Service: ${key} is Running
\ ... Else If '${item}' == '2' Log
\ ... Log Service: ${key} is not running