Dice!
54 lines of Ruby code. A dice roller and guesser.
EthanJustice (31)
Cool! I ended up getting the number right twice in a row!
Share your repls and programming experiences
54 lines of Ruby code. A dice roller and guesser.
Cool! I ended up getting the number right twice in a row!
Do you know what the
puts
function is?also you can change
rand(1...sides+1)
torand(1..sides)
@theangryepicbanana Yeah. I just like to use print.
@theangryepicbanana It might put a number like zero if it didn't have it.
@JoshuaKing1 why would it print out
0
? unless you are printing0
or"0"
, it shouldn't@theangryepicbanana It won't. You can try to type in 0 every time and it will say that it's invalid.
@theangryepicbanana Ruby does this weird thing so rand(1...7) will print out only 1, 2, 3, 4, 5, and 6. Not 7.
@JoshuaKing1 that's because you are using
...
instead of..
.1...7
does not include7
, but1..7
does. look here for an example https://repl.it/@theangryepicbanana/TinyVioletredLibrary@theangryepicbanana Thanks
@JoshuaKing1 no problem