There are many ways to write loops/iterative/repetitive behaviour in elisp.
C-hig (elisp)Iteration
has the basic options, including dotimes
, which is the canonical way to repeat something N times. E.g.:
(dotimes (_ 10) (insert "X"))
For the specific example of repeating a character N times, you might alternatively use make-string
.
(insert (make-string 10 ?X))
For more sophisticated looping options, I suggest starting at C-hig (cl)Iteration