next up previous contents
Next: The for Command Up: Iteration and Recursion Previous: Iteration and Recursion


Recall that a statement in Darwin is a command followed by either a semicolon or a colon. A sequence of statements is called a command sequence and consists of a sequence of commands separated by semicolons or colons. The separator after the last command is optional. The body of a loop consists of a code segment surrounded by the Darwin built-in commands do and od. We can create a simple loop using these commands.

    print('I need a terminating symbol after me');
    print('I do too but the next command doesn\''t');
    print('Hit the <ctrl - c> sequence')


Gaston Gonnet