i want to repeat my loop

Asked by aaysh

wait( , FOREVER)
sleep(2)
click( )
sleep(2)
click( )

This is my code i wanna repeat This whole proccess 100 times as it is

please provide code as i am new in sikuli and weak in coding

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Willie (willie-owens91) said :
#1

Link from the documentation:

http://www.jython.org/jythonbook/en/1.0/LangSyntax.html#for-loop

This should be the one you want:
 for x in range(10):
... print x
...

Remember you need to tab out what goes in the for loop ;)

Revision history for this message
Willie (willie-owens91) said :
#2

Can you edit posts???

Anyways, ignore those ellipses (...), those should not be typed

Revision history for this message
Willie (willie-owens91) said :
#3

Can you edit posts???

Anyways, ignore those ellipses (...), those should not be typed

Revision history for this message
aaysh (aayushbagga11) said :
#4

I want code i am unable to understand please solve my problem

just paste the loop code here for above problem

Revision history for this message
Willie (willie-owens91) said :
#5

for x in range(r):
   [your code here]

^ will loop r+1 times, setting the variable x to an incremental number each time (x begins at 0, ends being r) and then executing the indented code. You need not use the variable x in your code, but you still need it at least for the loop.

Revision history for this message
RaiMan (raimund-hocke) said :
#6

@ Willie:
for i in range(n):
will loop exactly n times beginning with 0 and ending with n-1

This corresponds with the fact that list indexing (arrays) starts with 0:

a = [1,2,3,4] # a list
for i in range(len(a)):
    print "a[%d] = %d"%(i, a[i])"

@ aaysh
look here: faq 1437
[HowTo] repeat something in a Sikuli script (make loops)

Can you help with this problem?

Provide an answer of your own, or ask aaysh for more information if necessary.

To post a message you must log in.