2012/12/12 Frank Weytjens <[email protected]>: > For example: > > (define (draw-shapes a-posn a-lon) > (cond > [(empty? a-lon) true] > [else (and (draw-circle a-posn (first a-lon)) > (draw-shapes a-posn (rest a-lon)))])) > > Why is there an AND needed in the else clause? > ELSE is normaly used for all other cases, so you don't need to test anymore. > In fact there is nothing tested in this line, it is just used to be > able to execute two expressions? > Isn't there an other solution for this? > That 's my point of view, I probably make a mistake, but I can't > figure out which one.
In the teaching languages only one expression is allowed after the else. If I remember correctly the Beginner languages does not include begin so and is used instead. In "real" Racket and is not needed. -- Jens Axel Søgaard ____________________ Racket Users list: http://lists.racket-lang.org/users

