Spaces generator
Posted: Sun Jun 08, 2025 1:52 pm
I needed a function to generate a string with a variable number of spaces.
Dav made such a function via a FOR … NEXT loop. See https://nitisara.ru/forum/viewtopic.php?t=1165
I made a recursive method:
Dav made such a function via a FOR … NEXT loop. See https://nitisara.ru/forum/viewtopic.php?t=1165
I made a recursive method:
Code: Select all
DEF spaces$(n) ' by Dutchman 2025
' return string with n spaces
IF n<1 THEN RETURN ""
IF n>1 THEN Spaces$=Spaces$(n-1)&" " ELSE Spaces$=" "
END DEF
FOR i=0 TO 8
PRINT i&spaces$(i);
NEXT i