Skip to main content
added 107 characters in body
Source Link
phils
  • 53.1k
  • 3
  • 84
  • 127

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

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))

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

Source Link
phils
  • 53.1k
  • 3
  • 84
  • 127

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))