Skip to main content


Returns a dynamic array consisting of the specified number of spaces for each element.




dynarray An expression that resolves to a dynamic array of positive integers, specifying the number of spaces you want in each corresponding element of the output dynamic array.


The SPACES function returns a dynamic array, each element of which contains the number of spaces specified for that element.

If an element value is missing, or is 0, a negative number, the null string, or a non-numeric string, no spaces are returned. A string is parsed as a number until a non-numeric character is encountered. Thus “7dwarves” is parsed as 7. If an element value is a decimal number, SPACES truncates it to an integer.

You can use the SPACE function to return a single string of spaces. You can also insert spaces using tabbing. MVBasic sets default tab stops at 10-column intervals.


The following example uses the SPACES function to return a dynamic array, each element of which contains one additional space. It concatenates the string of spaces in each of these elements to a single-letter string from the letters dynamic array:

PRINT CATS(letters,SPACES(spaces))

See Also

FeedbackOpens in a new tab