0

I've been having some trouble with this code. When I run it, it tells me:

unexpected $end, expecting }

Here's the code:

puts "You have been contacted, and pooled into a secret orginization. Please select your mode."
puts "Double Agent"
puts "Spy"
Mode_Split = gets.chomp
# This is the turning point.
if Mode_Split = "Double Agent"
puts "Your job is to return data points from the FXR (Free Xutopian Republic) to the SU (Shared Union)."
Agency_Members = [["HEAD OF AGENCY", "Robin Woods" "AKA: Dexter"],["HIGHER UPS", "Bryan Silk", "AKA: Silk Road", "Voilet Blue", "AKA: Hydraog"],["AGENTS","Alex Cooper", "Matt Syon", "Jack Cumberland" "Mike Schmidt", "Frits Fitsgerald"],["SUSPECTED DOUBLE AGENTS", "Jack Cumberland"]]
Agency_Members.each { |X| puts Agency_Members }

2 Answers 2

3

There are a few things wrong that should be addressed:

In answer to your question, you are missing your 'end' for 'if'

if <condition> stuff in here end

You also need to change the capital 'X' to lowercase. Upper case variables denote a constant, so a capital "X" can't be use as a block index.

Ruby convention is to use lower case/snake case for variable names, so Mode_Split and Agency_members should be mode_split and agency_members

Sign up to request clarification or add additional context in comments.

Comments

0

It looks to me like you're missing an end after the if statement. I'm not sure where you're trying to end that statement, but you need to do something like:

if Mode_Split = "Double Agent" 
  puts "Your job is to return data points from the FXR (Free Xutopian Republic) to the SU (Shared Union)."
  Agency_Members = [["HEAD OF AGENCY", "Robin Woods" "AKA: Dexter"],["HIGHER UPS", "Bryan Silk", "AKA: Silk Road", "Voilet Blue", "AKA: Hydraog"],["AGENTS","Alex Cooper", "Matt Syon", "Jack Cumberland" "Mike Schmidt", "Frits Fitsgerald"],["SUSPECTED DOUBLE AGENTS", "Jack Cumberland"]]
  Agency_Members.each { |X| puts Agency_Members }
end

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.