Jump to content

Loop structures: Difference between revisions

m
No edit summary
m (→‎{{header|Déjà Vu}}: Updates example)
Line 141:
Déjà Vu has a for-loop protocol, so you can write your own iterators. The most commonly used iterators are <code>in</code> and <code>range</code>. The first iterates over a list, the second takes two arguments and goes from the first to the second, like a classic for-loop.
<lang dejavu>for i range 1 3:
!print i # prints 1, 2 and 3</lang>
===While===
<lang dejavu>while true:
!print "This is the song that never ends..."</lang>
===Repeat===
<lang dejavu>repeat 3:
!print "This sentence is printed three times."</lang>
 
==[[Factor]]==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.