Page 1 of 1

Spaces generator

Posted: Sun Jun 08, 2025 1:52 pm
by Dutchman
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:

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

Re: Spaces generator

Posted: Tue Jun 10, 2025 6:10 am
by Henko
Hi Ton,
How do you insert a link to another post? I couldn’t figure it out.

Re: Spaces generator

Posted: Tue Jun 10, 2025 9:04 am
by Dutchman
Hoi Henk
Click on the 'chain' symbol

Re: Spaces generator

Posted: Tue Jun 10, 2025 10:20 pm
by Henko
Done it!. Thanks.