Why doesnt this work?


#1

I am doing a project for school and i was using "a night at the movies" for reference, but i dont understand why this doesnt work. you can skip over anything in quotes, im pretty sure thats not it. error message at bottom

battles = {
"Battle of Gonzales" => "October 2, 1835",
"Siege of San Antonio de Bexar" => "October 9, 1835",
"The Grass Fight" => "November 26, 1835",
"Battle of San Antonio de Bexar" => "December 5, 1835",
"Convention of 1836" => "March 1, 1836",
"The Alamo" => "March 6, 1836",
"The Runaway Scrape" => "March, 1836",
"Battle of San Jacinto" => "April 21, 1836",
}

puts "The 'Application' of Freedom in Texas"
puts "Coded completely by DATA EXPUNGED"
puts "Type a battle name or list for a list of the battles"

choice = gets.chomp.downcase
case choice
when "list" battles.each do |b, t|
puts "#{b}: #{t}"
end
when "battle of gonzales"
puts "The first conflict between Texas and Mexico was about a small brass cannon given to the settlers in Gonzales for protection against Native Americans. Colonel Domingo de Ugartechea sent Lieutenant Francisco de Castaneda and 100 soldiers to retrieve the cannon, but they were greeted with a small force of texans and a flag on the cannon that read Come and Take It. Under the command of John h. Moore, the Texans attack the Mexican forces. When asked why by Castaneda, the Texans answered To keep the cannon and uphold the Constitution of 1824. Castaneda soon retreated to San Antonio, and the Texans used the battle to create support for a confrontaion against the Mexican army."
when "siege of san antonio de bexar"
puts "A week after the battle of Gonzales, Mexican troops surrendered to a group of 120 Texans that attacked the garrison there. The victories so far bolstered Texas confidence and Stephen F. Austing soon took command of an army of 300 Texans, named The Army of the People and marched toward San Antonio. However, General Cos of Mexico had 650 soldiers there, greatly outnumbering the Texans, let alone the fact that the Texans lacked any heavy artillery. Instead of a full-on battle, Austins Army of the People lay siege to San Antonio de Bexar."
when "the grass fight"
puts "Austin left the Army to gether money and supplies, and Edward Burleson sever as officer in his absence. On November 26, a man named Erastus Deaf Smith repoted a Mexican force moving toward San Antonio. Beleiving that they were transporting silver, the Texans attacked, but afterward the Texans captured over 3 dozen mules, but istead of silver, they were carrying grass."
when "battle of san antonio de bexar"
puts "With winter approaching, Burleson and the Texan army leaders decided not to attack. Benjamin Milam disagreed with that decision, stating that a victory was vital to the cause of independence and that it would encourage the Texans to keep fighting. Milam led a suprise attack on houses noth of San Antonios public square. The Mexicans fired on them, halting the Texans. The battle lasted four days, until the Mexicans asked for terms of surrender. The Mexicans were required to move south of the Rio Grande river, and General Cos promised to never again fight against the colonists or tha Constitution of 1824."
when "convention of 1836"
puts "While earlier conventions sided with Mexico and sought support from other Mexican states, the fourth meeting was mainly determined to break away from Mexico, but they had to act quickly as Santa Annas army was already in Texas since February 23. the meeting was held in Washington-on-the-Brazos. Richard Ellis was elected chairman of the convention, H.S. Kimble was secretary. George Childress wanted to write a declaration of independence and was named chairman of the committee completing that task. March second was the day they were finished, as well as Texas Independence day. They then wrote a constitution and elected Sam Houston as the commander of the Texas military."
when "the runaway scrape"
puts "When settlers heard of the approaching Mexican force, many fled and many others left to fight, leaving old men, women, and children. Stephen F. Austin's colony dissapated within a few days, and the event became known as The Runaway Scrape. The settlers traversed, but frquently were halted by high waters and had to build rafts just to get people across. Many fell ill and died or starved."
when "the alamo"
puts "After 12 days of siege, Santa Anna ordered a full attack and columns of Mexican soldiers marched toward the Alamo, to be greeted with cannon and rifle fire by the Texans. The third wave however, reached the walls of the Alamo through sheer numbers and were able to storm over the walls. At this time William B. Travis was killed, and the Texans were forced back into the compound of the abandoned mission. About 90 minutes after the start of the attack, it was over, with Texan death tolls including Bowie, Crockett, and Travis. None were spared except one, Brigido Guerrero convinced Santa Anna that he was forced to fight, and the only others left were women and children. This battle only encouraged citizens to fight, forming the well-known battle cry, Remember the Alamo!"
when "battle of san jacinto"
puts "Mexican General Martin Perfecto de Cos added 540 soldiers to Santa Annas ranks, his men were tired and hungry from travel though. After learning of this Sam Houston sent Deaf Smith and some others to destroy the bridge Cos had used to cross the nearby Vinces Bayou, severing connection with Mexican reinforcements, and destroying a Mexican and Texan retreat path. By 3:30 Houston had assembled the Texan army and approached the Mexican base. Their presence wasnt noticed until they were too close for Mexican cannons to be of any use, and when fired the shells soared over the heads of the Texan army. The Texans were soon storming the base, shouting Remember the Alamo! Remember Goliad. The camp plunged into chaos and orders couldnt be heard over the noise. In 18 minutes the battle was over, and several more hours were spent tracking down the Mexicans that had fled. Among the prisoners was Santa Anna, and, while not recognized by the Texans, he was recognized by his own soldiers, and the defeated officer was taken to Houston."
else
puts "Sorry, I dont understand. Type list for a list of battles."
end

(ruby):17: syntax error, unexpected tIDENTIFIER, expecting keyword_then or ',' or ';' or '\n'
when "list" battles.each do |b, t|
^
(ruby):20: syntax error, unexpected keyword_when, expecting $end
when "battle of gonzales"
^


#2

Not sure but I think it wants you to change this line:

when "list" battles.each do |b, t|

to these lines:

when "list"
battles.each do |b, t|

#3

i tried that and it didnt work, but thanks! either way i decided not to include the list function or the thing at the top and it worked. i probably confused it by having variable names match array names.