- Why are the functions written in this order?
I inverted the order and it also works.
I did: start, bear_room, gold_room, dead, cthulhu_room. I would have written it this way.
I could invert bear_room and cthulhu_room, dead could go wherever, but I would definitely write start at the beginning.
- Now the gold_room logic…
I need the user to enter a number equal or greater than 0, right?
Did this in the most simple way and it works. Why use =~?
I read about it in ruby docs and I found a few examples.
What I needed
/[0-9]/was better explained under .match.
I could use
if /[0-9]/ =~ choice, but I just used
if choice >= "0"and it works.
to_iunder it converts anything to integer so…
If I write rose 45 as an answer it converts it to 45.
Is using =~ better? Or it doesn’t matter and I could just use >= 0?
If =~ is better, why?
Hey, sorry I totally missed this question. The default notifications on this are set such that you really don’t see anything when it’s posted. Anyway I think you’re way past this but if you still have questions go ahead and bug me.