Since this is pretty much the top half of a string diamond I took my answer from that challenge and used just the first half of the code but it isn't working like expected, can someone tell me where I went wrong? 😥
Ruby:
defriamond_i_mean_ryramid(karat)unlesskarat.odd?&&karat>0raiseArgumentError.new("You want a #{karat} karat ~~diamond~~ pyramid? That's crazy!")endcut=1layers=[]untilcut>karatlayers.push(("*"*cut).center(karat))
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Since this is pretty much the top half of a string diamond I took my answer from that challenge and used just the first half of the code but it isn't working like expected, can someone tell me where I went wrong? 😥
Ruby: