Function: cl-dotimes

cl-dotimes is an autoloaded macro defined in cl-macs.el.gz.

Signature

(cl-dotimes (VAR COUNT [RESULT]) BODY...)

Documentation

Loop a certain number of times.

Evaluate BODY with VAR bound to successive integers from 0, inclusive, to COUNT, exclusive. Then evaluate RESULT to get return value, default nil.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-macs.el.gz
;;;###autoload
(defmacro cl-dotimes (spec &rest body)
  "Loop a certain number of times.
Evaluate BODY with VAR bound to successive integers from 0, inclusive,
to COUNT, exclusive.  Then evaluate RESULT to get return value, default
nil.

\(fn (VAR COUNT [RESULT]) BODY...)"
  (declare (debug cl-dolist) (indent 1))
  (let ((loop `(dotimes ,spec ,@body)))
    (if (advice-member-p 'cl--wrap-in-nil-block 'dotimes)
        loop `(cl-block nil ,loop))))