简体   繁体   中英

Can you help me? I don't understand this error I'm new to ruby

puts "Welcome to the trail of tears"
puts "Play full game or Play a scene"
mode_answer = gets.chomp
mode_answer.downcase!
if mode_answer == "full game"
    puts "enjoy!"
    puts "you wake up"
    puts "at your witchott you see a officer"
    puts "he says that you need to get out of this land"
    puts "you agree"
    puts "because youre tired of these storms"
    puts "he seems weird"
    puts "wait..."
    puts "something isn't right"
    puts "I don't know what is it"
    puts "but..."
    puts "right after that thought"
    puts "you see your friends, family, and chiefs moving"
    puts "then you feel a push"
    puts "you go with them"
    puts "you see your village"
    puts "you see smoke"
    puts "then fire"
    puts "you see darkness"
    puts "you see a wagon"
    puts "leave it or Go in it"
    fullaction1answer = gets.chomp
    fullaction1answer.downcase!
   if fullaction1answer == "go in it"
       puts "you go in"
       puts "you find cans of fish, a lighter, a oregon trail poster, and 7 pounds of wooden logs"
       puts "you come out"
       puts "you have food for the a sixthteenth of the entire long haul"
       puts "Your tribe decided to camp for the nigt in Columbia, SC"
       puts "You wake up"
       puts "in the night"
       puts "you see a black figure"
       puts "get out of the teepee"
       puts "investigate or stay"
       fullaction2answer = gets.chomp
       fullaction2answer.downcase!
      if fullaction2answer == "investigate"
        puts "you go to to the black"
           puts "you see a badge"
           puts "why are you here, the man asked"
           puts "you tell him why"
           puts "you see he's a officer"
           puts "he start to look at you deeply"
           puts "he starts to handcuff you"
           puts "you see 38 other officers"
           puts "you have two options, jump and hide or take your fate"
           fullaction3answer = gets.chomp
           fullaction3answer.downcase!
          if fullaction3answer == "jump and hide"
              puts "you ran away and jump"
              puts "you lost a eighth of your canned food"
              puts "you got lost in the forest"
              puts "you see a empty box of bananas"
              puts "you continue walking"
              puts "10 days later..."
              puts "30 energy, 10 hunger, 40 health"
              puts "Alanta, Georgia"
              puts "You go into a hotel since"
              puts "you forgot to take the teepee"
              puts "you see a guard"
              puts "he looks unfriendly, but we'll see"
              puts "you talk to him"
              puts "he's friendly"
              puts "Would you trust him"
              puts "Yes or No"
              fullaction4answer = gets.chomp
              fullaction4answer.downcase!
              if fullaction4answer == "yes"
                  puts "he gives you a map"
                  puts "your room is ready"
                  puts "may 12, 1845."
                  puts "the guard will help you along the way"
                  puts "he has a wagon"
                  puts "you put the food in the chest"
                  puts "you take out dried corn"
                  puts "You are no longer hungry"
                  puts "time to go west"
                  puts "you connect the wagon"
                  puts "tony helps you by you some rope"
                  puts "+2 rope"
                  puts "you and tony drag the wagon"
                  puts "you enter alabama"
                  puts "12 days later..."
                  puts "56 hunger, 79 energy, 81 health"
                  puts "you enter missisipi"
                  puts "3 days later"
                  puts "78 hunger, 23 energy energy, 79 health"
                  puts "Missisipi-Alabama border"
                  puts "1845 may 17"
                  puts "you and the guard (tony) see the water"
                  puts "you get the axe"
                  puts "and chop some wood"
                  puts "and tony does it too"
                  puts "soon you and tony make it into logs"
                  puts "then you and tony put the logs under the wagon"
                  puts "you sercure the logs"
                  puts "you and tony push the wagon into the river"
                  puts "you and him hop on"
                  puts "you have extra wood for two paddles"
                  puts "where do you paddle"
                  puts "Upstream or Across"
                  fullaction5answer = gets.chomp
                  fullaction5answer.downcase!
                  if fullaction5answer == "upstream"
                        puts "you went upstream"
                        puts "5 days later..."
                        puts "You went upstream"
                        puts "eating canned corn goes to eating small fish"
                        puts "and drinking water goes to drinking river water"
                        puts "you both are starving"
                        puts "near st louis you tie a rope to the wagon"
                        puts "do you go to hunt or tony"
                        fullaction6answer = gets.chomp
                        fullaction6answer.downcase!
                        if fullaction6answer == "you"
                           puts "you go to hunt"
                           puts "you try to use your arrow"
                           puts "+15 food"
                           puts "you try to get some wood"
                           puts "you found a tree and an axe"
                           puts "+1 axe"
                           puts "you chop the tree"
                           puts "+30 wood"
                           puts "tony comes over"
                           puts "you start the fire"
                           puts "you light the campfire"
                           puts "you and tony drag the wagon into the area of the campfire"
                           puts "+50 hunger"
                           puts "you and tony no longer feel hungry"
                           puts "you and tony go into the wagon"
                           puts "and go to sleep"
                           puts "next day"
                           puts "you hear a sound"
                           puts "you see a tribe member"
                           puts "you gladly invite him into your wagon"
                           puts "he sits down"
                           puts "the next day"
                           puts "you walk into a forest"
                           puts "after hours of walking"
                           puts "you see a village"
                           puts "you see your friends"
                           puts "you say hi"
                           puts "you see your family"
                           puts "they greet you"
                           puts "you follow your aunt into a wooden structure"
                           puts " you set up everything"
                           puts "your new friend and tony goes into the hut and set up their bed"
                           puts "thanks for playing!"
                           puts "====CREDITS===="
                           puts "language - `ruby"
                           puts "SantiDev - Literally everything"
                        elsif fullaction6answer == "tony"
                           puts "tony drowned"
                           puts "failed"
                        end
                  elsif fullaction5answer == "across"
                        puts "boring ending"
                        puts "it's a win but it's boring"
            elsif fullaction4answer == "no"
                  puts "You got lost and died"
              end
          elsif fullaction3answer == "take my fate"
              puts "you got in trouble and start a new life in prison"
          end
      elsif fullaction2answer == "stay"
          puts "you got imprisoned"
      end
   elsif fullaction1answer == "leave it"
       puts "Failed"
       puts "You starved to death"
   end
elsif mode_answer == "a scene"
    puts "What major event"
    puts "the first foe"
    puts "the guard encounter"
    puts "the missisipi"
    puts "getting hungry"
    puts "the first non tribe friend"
    puts "the forest"
    puts "welcome to your new settlement"
    scene_answer = gets.chomp
    scene_answer.downcase!
    if scene_answer == "the first foe"
        puts "you wake up"
        puts "get out of the teepee"
        puts "Then, You see a figure"
        puts "what do you do, investigate or stay"
        scene1_action1_answer = gets.chomp
        scene1_action1_answer.downcase!
       if scene1_action1_answer == "investigate"
           puts "you go to to the black"
           puts "you see a badge"
           puts "why are you here, the man asked"
           puts "you tell him why"
           puts "you see he's a officer"
           puts "he start to look at you deeply"
           puts "he starts to handcuff you"
           puts "you see 38 other officers"
           puts "you have two options, jump and hide or take your fate"
           scene1_action2_answer = gets.chomp
           scene1_action2_answer.downcase!
          if scene1_action2_answer == "jump and hide"
              puts "you ran away and jump"
              puts "full story for more"
          elsif scene1_action2_answer == "take my fate"
              puts "you got in trouble and start a new life in prison"
          end
       elsif scene1_action1_answer == "stay"
           puts "you stayed."
           puts "Failed"
           puts "the foe got to you"
       end
        
    elsif scene_answer == "the friendly guard guard encounter"
        puts "Alanta, Georgia"
        puts "You go into a hotel since"
        puts "you forgot to take the teepee"
        puts "you see a guard"
        puts "he looks unfriendly, but we'll see"
        puts "you talk to him"
        puts "he's friendly"
        puts "Would you trust him"
        puts "Yes or No"
        scene2_action1_answer = gets.chomp
        scene2_action1_answer.downcase!
       if scene2_action1_answer == "yes"
           puts "he gives you a map"
           puts "your room is ready"
           puts "may 12, 1845."
           puts "the guard will help you along the way"
           puts "he has a wagon"
           puts "you put the food in the chest"
           puts "you take out dried corn"
           puts "You are no longer hungry"
           puts "time to go west"
           puts "full story for more"
       elsif scene2_action1_answer == "no"
           puts "You got lost and died"
       end
    elsif scene_answer == "the missisipi"
        puts "Missisipi-River border"
        puts "1845 may 17"
        puts "you and the guard (tony) see the water"
        puts "you get the axe"
        puts "and chop some wood"
        puts "and tony does it too"
        puts "soon you and tony make it into logs"
        puts "then you and tony put the logs under the wagon"
        puts "you sercure the logs"
        puts "you and tony push the wagon into the river"
        puts "you and him hop on"
        puts "you have extra wood for two paddles"
        puts "where do you paddle"
        puts "Upstream or Across"
        scence3_action1_answer = gets.chomp
        scence3_action1_answer.downcase!
       if scence3_action1_answer == "upstream"
           puts "you went upstream"
           puts "full game for more"
       elsif scence3_action1_answer == "across"
           puts "boring ending"
           puts "it's a win but it's boring"
       end
    elsif scene_answer == "getting hungry"
        puts "You went upstream"
        puts "eating canned corn goes to eating small fish"
        puts "and drinking water goes to drinking river water"
        puts "you both are starving"
        puts "near st louis you tie a rope to the wagon"
        puts "do you go to hunt or tony"
        scence4_action1_answer = gets.chomp
        scence4_action1_answer.downcase!
        if scence4_action1_answer == "you"
           puts "you go to hunt"
           puts "you try to use your arrow"
           puts "+15 food"
           puts "you try to get some wood"
           puts "you found a tree and an axe"
           puts "+1 axe"
           puts "you chop the tree"
           puts "+30 wood"
           puts "tony comes over"
           puts "you start the fire"
           puts "you light the campfire"
           puts "you and tony drag the wagon into the area of the campfire"
           puts "+50 hunger"
           puts "you and tony no longer feel hungry"
           puts "you and tony go into the wagon"
           puts "and go to sleep"
           puts "full story for more"
        elsif scence4_action1_answer == "tony"
           puts "tony drowned"
           puts "failed"
        end
    elsif scene_answer == "first native american friend"
        puts "next day"
        puts "you hear a sound"
        puts "you see a tribe member"
        puts "you gladly invite him into your wagon"
        puts "he sits down"
        puts "the next day"
        puts "full story for more"
    elsif scene_answer == "the forest"
        puts "you walk into a forest"
        puts "full story for more"
    elsif scene_answer == "new land"
        puts "you see a village"
        puts "you see your friends"
        puts "you say hi"
        puts "you see your family"
        puts "they greet you"
        puts "you follow your aunt into a wooden structure"
        puts " you set up everything"
        puts "your new friend and tony goes into the hut and set up their bed"
        puts "thanks for playing!"
        puts "====CREDITS===="
        puts "language - ruby"
        puts "SantiDev - Literally everything"
    end
end

This is the error: syntax error, unexpected end-of-input, expecting end at line 325 (last line) Background: I'm new to ruby and this is a project to get me going with ruby development. Help?

I tried to remove line 237 and 236. And it just make it have less sense

What in the world does it mean that the last line don't have end

Ruby if...else statement syntax:

if conditional [then]
   code...
[elsif conditional [then]
   code...]...
[else
   code...]
end

The message means that you missed an end somewhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM