Spaces generator

Post Reply
User avatar
Dutchman
Posts: 869
Joined: Mon May 06, 2013 9:21 am
My devices: iMac, iPad Air, iPhone
Location: Netherlands
Flag: Netherlands

Spaces generator

Post 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
Last edited by Dutchman on Tue Jun 10, 2025 9:05 am, edited 1 time in total.

Henko
Posts: 826
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Spaces generator

Post by Henko »

Hi Ton,
How do you insert a link to another post? I couldn’t figure it out.

User avatar
Dutchman
Posts: 869
Joined: Mon May 06, 2013 9:21 am
My devices: iMac, iPad Air, iPhone
Location: Netherlands
Flag: Netherlands

Re: Spaces generator

Post by Dutchman »

Hoi Henk
Click on the 'chain' symbol

Henko
Posts: 826
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Spaces generator

Post by Henko »

Done it!. Thanks.

Post Reply