Run a set of lines multiple times using while

Asked by srijith

How to run a set of lines multiple number of times using while loop ?
like
while not find(img)

{
---------------
---------------
--------------
}

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
srijith
Solved:
Last query:
Last reply:
Revision history for this message
Sergey Darovskih (darovskih) said :
#1

use indents, and don't forget colon after condition:

while not find(img):
    dosomething()
    continuedoingsomething()
    etc()
dosomethingafterwhile()

Revision history for this message
srijith (electronicmails1) said :
#2

The Solution is not clear.
How to close the statements inside while ?

I am getting Syntax error when I add while statement in SIKULI for Leopard , but I dont get this Syntax error for while statement in SIKULI for snow leopard.

Revision history for this message
Sergey Darovskih (darovskih) said :
#3

the key is indents :)
when you use some spaces in the beginning of the string, Sikuli understands that it is a part of a while.

Revision history for this message
srijith (electronicmails1) said :
#4

Ya! I just missed the indents
thnks