简体   繁体   English

'Else'是保留关键字Robot Robot脚本中的错误

[英]'Else' is a reserved keyword Error in Robot Framework script

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

You are forgetting to use the continuation characters. 您忘记使用延续字符。 All of the "else" and "elseif" words, and the other keywords and arguments, must all be arguments to the "run keyword if" keyword. 所有“ 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM