Go to the first, previous, next, last section, table of contents.

繰り返し

Special Form: while test-form forms*

これは GNU Emacs Lisp における(唯一の) 繰返しのためのフォームです。これは test-form を評価し、その値が non-nil である場合、フォームの残りのものを順 に評価し (再び) test-form を評価するという風に繰り返しを行ないます。 test-form が nil に評価された場合、while フォームを exit します。 while は 常に nil を返します。

  (setq num 0)
  => 0
  (while (< num 5)
     (princ (format "That was number %d! \n" num))
     (setq num (1+ num)))
  -> That was number 0!
  -> That was number 1!
  -> That was number 2!
  -> That was number 3!
  -> That was number 4!
  => nil
  (while (< num 5)
         (princ (format "That was number %d! \n" num))
         (setq num (1+ num)))
  => nil


Go to the first, previous, next, last section, table of contents.