Function: --dotimes

--dotimes is a macro defined in dash.el.

Signature

(--dotimes NUM &rest BODY)

Documentation

Evaluate BODY NUM times, presumably for side effects.

BODY is evaluated with the local variable it temporarily bound to successive integers running from 0, inclusive, to NUM, exclusive. BODY is not evaluated if NUM is less than 1. This is the anaphoric counterpart to -dotimes.

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defmacro --dotimes (num &rest body)
  "Evaluate BODY NUM times, presumably for side effects.
BODY is evaluated with the local variable `it' temporarily bound
to successive integers running from 0, inclusive, to NUM,
exclusive.  BODY is not evaluated if NUM is less than 1.
This is the anaphoric counterpart to `-dotimes'."
  (declare (debug (form body)) (indent 1))
  (let ((n (make-symbol "num"))
        (i (make-symbol "i")))
    `(let ((,n ,num)
           (,i 0)
           it)
       (ignore it)
       (while (< ,i ,n)
         (setq it ,i ,i (1+ ,i))
         ,@body))))