Reputation: 1
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 }
Upvotes: 0
Views: 43
Reputation: 393
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
Upvotes: 3
Reputation: 135
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
Upvotes: 0