1

I am getting error

'Else' is a reserved keyword

the code snipet goes as follows , can anyone guide me the resolution ?

   :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
4

1 回答 1

1

您忘记使用连续字符。所有“else”和“elseif”词,以及其他关键字和参数,都必须是“run keyword if”关键字的参数。

: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
于 2015-07-02T19:05:59.733 回答