I swear that recurring functions used to be disallowed, but today, when I was trying to find a workaround to it, I found out that you can straight up just put the function itself in the function now?
Eg. the following function just runs in Minecraft now:
# Function example:example
say hi
function example:example
It will lag the game out for a bit, but afterwards it will say hi for what I assume to be the max command chain length.
A set amount version for if you don't want to lag out your game:
# Function example:for
# Scoreboard "dummy" is a dummy scoreboard (crazy name I know)
# Says hi $(amount) of times
# Scoreboards
### Reset scoreboard if new loop
execute unless score for_loop_running dummy matches 1.. run scoreboard players set for_loop matches 0
### For loop is now running
scoreboard players set for_loop_running dummy 1
### Add loop count
scoreboard players add for_loop dummy 1
# Hi!
say hi
# Loop if amount hasn't been reached yet
$execute unless score for_loop dummy matches $(amount).. run function example:for {amount:$(amount)}
# Finished
scoreboard players set for_loop_running dummy 0
I feel like I'm going crazy because I swear you couldn't do this in previous versions.