Repeat / Foreach


Repetitive structure with continuation counter



    (repeat n
        do_statements
    )
  • counter specified as a number

  •     (foreach name list
            do_statements
        )
  • counter specified as a list
    name is assigned each element in list, consecutively



  • Examples

      (setq test 1)

      (repeat 4
          (princ test)
          (princ "\n")
          (setq test (+ 1 test))
      )

      (test_repeat 5)

      (test_repeat 0)

      (foreach n '(a b c)
          (princ n)
          (princ "\n")
      )

    This website has been archived and is no longer maintained.