Rebol3 Code Examplex
Repeat
Write a procedure which accepts as arguments another procedure and a positive integer. The latter procedure is executed a number of times equal to the accepted integer.
Rebol [
title: "Rosetta code: Repeat"
file: %Repeat.r3
url: https://rosettacode.org/wiki/Repeat
]
my-repeat: function [
"Calls a function or evaluates a block N times"
fn [any-function! block!] "Function or block to execute"
n [integer!] "Number of repetitions"
][
loop n [do fn]
]
fun: does [print now]
my-repeat :fun 2
my-repeat [print "hello"] 3Output:
12-Jun-2026/16:03:30+2:00
12-Jun-2026/16:03:30+2:00
hello
hello
hello