Ruby code to print stars like a Triangle
SYMBOL = "*" #Change the Symbol def triangle(i, t=0) if i == 0 return 0 else puts ' ' * ( i + 1 ) + SYMBOL * ( t * 2 + 1 ) return triangle( i - 1, t + 1 ) end end triangle(5)
* * *** * ***
Comments :