'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

Answers


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.

: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

Need Your Help

Retrieving account information for an EKCalendar

iphone ios calendar eventkit

I am using EventKit in my app and would like to find out what account a calendar belongs to.

Updating Liferay User Lockout

java liferay liferay-6

I've built a portlet that can administrate users in Liferay.