Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Thomas Perkins
Thomas Perkins
496 Points

back to the other room

So, I'm making a game and in one point I want the game to "transport" somebody to a different room if they get the answer wrong.

if choice =~ /c/i
    freedom

    if choice =~ /a, b, d/i
        death_room

    else
        dead("You are done.")
    end

    elsif choice = /b/i
    corpse_room

else
    dead("The rats get mad and start to devour you!")
end

In the section that says "choice =~ /a, b ,d/i" I want it to also say "You have been transported to another room. Would I use a return value or just a normal puts statement for that?

Also I have already tried the "puts" statement and it doesn't show up with "You have been transported to another room"

If you could help me out it would be very much appreciated, thank you.

1 Answer

Thomas Perkins
Thomas Perkins
496 Points

Disregard this, I figured it out!