# It was just a bug

Inspired by the bugged output in @Carcigenicate's Clojure answer for the Print this diamond challenge.

## Print this exact text:

1        2        3        4        5        6        7        8        9        0
1       2       3       4       5       6       7       8       9       0
1      2      3      4      5      6      7      8      9      0
1     2     3     4     5     6     7     8     9     0
1    2    3    4    5    6    7    8    9    0
1   2   3   4   5   6   7   8   9   0
1  2  3  4  5  6  7  8  9  0
1 2 3 4 5 6 7 8 9 0
1234567890
1 2 3 4 5 6 7 8 9 0
1  2  3  4  5  6  7  8  9  0
1   2   3   4   5   6   7   8   9   0
1    2    3    4    5    6    7    8    9    0
1     2     3     4     5     6     7     8     9     0
1      2      3      4      5      6      7      8      9      0
1       2       3       4       5       6       7       8       9       0
1        2        3        4        5        6        7        8        9        0


(From the middle outward in both directions, each digit is separated by one more space than the previous line.)

## Challenge rules:

• There will be no input (or an empty unused input).
• Trailing spaces are optional.
• A single trailing new-line is optional.
• Leading spaces or new-lines are not allowed.
• Returning a string-array isn't allowed. You should either output the text, or have a function which returns a single string with correct result.

## General rules:

• This is , so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
• Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
• Default Loopholes are forbidden.
• Also, please add an explanation if necessary.
• Is outputting an array of strings - 1 string per line - allowed? – Shaggy Jul 3 '17 at 9:37
• @Shaggy Sorry, in this case it should either return a single string with new-lines, or output the result. I've added this as rule to the challenge. – Kevin Cruijssen Jul 3 '17 at 11:06
• No worries, Kevin; was just chancing my arm to see if I could save myself a couple of bytes. – Shaggy Jul 3 '17 at 11:09
• @Shaggy Hehe. What other reason would we have to ask question in a code-golf challenge, besides having the purpose of saving those few bytes? ;) – Kevin Cruijssen Jul 3 '17 at 11:23
• Ha, that's awesome. I was wondering why that answer suddenly got so much attention. Thanks! – Carcigenicate Jul 3 '17 at 19:41

# Lua, 106 85 bytes

-21 bytes thanks to user202729

n="1L2L3L4L5L6L7L8L9L0"for i=-8,8,1 do print((n:gsub("L",(" "):rep(math.abs(i)))))end


Output has a trailing newline

Ungolfed

n="1L2L3L4L5L6L7L8L9L0"
for i=-8,8,1 do
print((n:gsub("L",(" "):rep(math.abs(i)))))
end


Try It Online

• Hi there. Would you mind adding a TIO-link with test code? Lua should be available on TIO as well. – Kevin Cruijssen Apr 5 '18 at 7:36
• You can save 5 bytes by using (" "):rep. – user202729 Apr 5 '18 at 12:37
• You can also get it down to 82 bytes with pattern. Hint: %1. – user202729 Apr 5 '18 at 12:43

# brainfuck, 209 bytes

++++++++[->+>+>+>++++>++++++>+>>+<<<<<<<<]>++>+>+>>>>>+<<<<<<-[->>>>>>[-<<<+.>[-<<.>>>+<]>[-<+>]>>+<]>[-<+<<<->>>>]<<<-<.<<<<.>]>[->>>>>[-<<<+.>>>>>[->+<<<<<<<.>>>>>>]>[-<+>]<<+<]>[-<+<<<->>>>]>+<<<<<.<<<<.>>]


Try it online!

I noticed there wasn’t a brainfuck submission yet, so I gave it my best shot. Definitely not the most golfed solution possible, but I’m not upset with the result.

## Canvas, 20 15 bytes

９｛９∔ ×９Ｒ0∔∑；＊］─


Try it here!

Explanation:
９｛９∔ ×９Ｒ0∔∑；＊］─  | (Full code)
| Print (implicit)
９∔ ×               | 9-i spaces
９Ｒ0∔∑；＊    | Inserted between the characters of the string "1234567890"
９｛                    | For each i in [1-9]
］   | Separated by newlines
─  | Palindromized vertically with 1 line of overlap


# QBasic, 66 bytes

An undeclared subroutine that takes no input and outputs to STDOUT

FOR i=-8TO 8
FOR j=49TO 57
?CHR$(j)SPC(ABS(i)); NEXT ?"0 NEXT  # Elixir, 126 bytes Enum.each 8..-8,fn n->IO.puts Enum.map Enum.into(1..10,[],&(rem &1,10)),&(Integer.to_string(&1)<>String.duplicate" ",abs n)end  Try it online! Enum.each 8..-8, fn n-> IO.puts Enum.map Enum.into(1..10, [], &(rem &1,10)), &(Integer.to_string(&1) <> String.duplicate" ",abs n) end  For each number in the range 8 to -8, do this anonymous function with the number as n. The function (inner to outer) sets the range 1 to 10 into a list after applying the remainder mod 10 (so we have the list 1,2,3,4,5,6,7,8,9,0). Then maps that list of numbers into strings, and concatenates the absolute value of n spaces onto the end. After getting each string we print out the whole list of strings... and Elixir doesn't put any delimiter on that by default. Output: 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1234567890 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0  # Pip-l, 18 bytes (\,t)%tJsXAB_M-8,9  The -l flag outputs the list of results one per line. Try it online! # Sisi, 239 bytes 0set s8 1set d0-1 2set o"" 3set i1 4set o o+i 5jumpif i7 6jump17 7set x s 8jump11 9set o o+" " 10set x x-1 11jumpif x9 12set c9>i 13jumpif c15 14set i0-1 15set i1+i 16jump4 17print o 18set s s+d 19jumpif s21 20set d1 21set q9>s 22jumpif q2  Try it online! The basic strategy is to run a loop from 8 down to 0 and back up to 8, constructing each line accordingly and printing it. I'm not going to write a detailed explanation, but if you're trying to follow the algorithm, the following key to the variable names may be helpful: • s: number of spaces to print between digits • d: direction of change in s (-1 or 1) • o: the current line of output • i: the current digit • x: loop counter while printing spaces • c: conditional that tests whether i is less than 9 (if not, we set it to -1 so it gets incremented to 0 instead of 10) • q: conditional that tests whether s is less than 9 (if so, we continue looping) # ///, 244 bytes /*/\/\///X/0 1*j/\/X*x/ *S/x *s/SS*-/S *_/s *(/- *)/_ *A/)2)3)4)5)6)7)8)9)*Bj_2_3_4_5_6_7_8_9_*Cjs2s3s4s5s6s7s8s9s*Dj(2(3(4(5(6(7(8(9(*Ej-2-3-4-5-6-7-8-9-*FjS2S3S4S5S6S7S8S9S*Gjx2x3x4x5x6x7x8x9x*Hj 2 3 4 5 6 7 8 9 /1ABCDEFGHX23456789HGFEDCBXA0  Try it online! # Tcl, 99 bytes time {incr i;time {puts -nonewline [incr j][string repe " " [expr abs(9-$i)]]} 9;puts 0;unset j} 17


Try it online!

# Pushy, 27 bytes

Not the most elegant solution, but it does the job.

N9X@wL:Ocv:32;ZT:hT%#^"v;T'


Try it online!

Explanation:

N                                \ Set printing delimiter to empty string
9X                              \ Push range(9) to stack: [0, 1, 2, 3, 4, 5, 6, 7, 8]
@                             \ Reverse: [8, 7, 6, 5, 4, 3, 2, 1, 0]
w                            \ Mirror: [8, 7, 6... 1, 0, 1... 6, 7, 8]
L:                          \ Length (17) times do:
Oc                        \   Go to (cleared) auxiliary stack
v:                      \   Pop top of main stack, and that many times:
32;                           Push character 32 (space)
Z                  \   Push 0
T                 \   Ten times do:
:hT%             \      counter = (counter + 1) mod 10
#            \      Print the counter
^"v;        \      Print the rest of the stack (spaces)
T'      \   Print a newline

• Would you mind adding an explanation? – Kevin Cruijssen Dec 16 '18 at 19:05

# Python 2, 72 bytes

for i in range(-8,9):print(('%-'+'%ds'%-~abs(i))*10)%tuple('1234567890')


Try it online!

# Vim, 53 bytes

i1234567890^[^qq8a ^[lq8@qqeYpPqqqlxbequ^qw9@q@eq7@wdj


Where ^[ is the ESC Key.

i1234567890^[^       puts 1-9+0 in the buffer and returns the cursor to the beginning
qq8a ^[lq8@q         puts 8 spaces between each of the numbers
qeYpPq               records @e to duplicate the line twice and stay on the middle one
qqlxbequ^            records @q to delete one space between numbers and undoes it
qw9@q@eq             records @w to do @q 9 times, then @e
7@wdj                does @w 7 more times, then deletes two lines


# Python, 84 bytes

for x in range(-8,9):
z=""
for y in range(1,11):z+=str(y%10)+" "*abs(x)
print(z)


Try it online

# VBA, 58 bytes

An immediate window function that takes no input and outputs to the console.

For i=-8To 8:For j=1To 9:?j &""Spc(Abs(i));:Next:?"0":Next


### Ungolfed and Commented

For i=-8To 8        ''  Iterate i from -8 to 8
For j=1To 9         ''  Iterate j from 1 to 9
?j &""Spc(Abs(i));  ''  Print j and i spaces
Next                ''  Loop j
?"0"                ''  Print 0, with a newline
Next                ''  Loop i


# JavaScript, 71 bytes

f=(i=8,q=[..."1234567890"].join(" ".repeat(i)))=>i?q+
+f(i-1)+
+q:q