Need help with Ruby hashes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Need help with Ruby hashes

Can anyone tell me why the linked code isn't working? What it's supposed to do is output to the screen: ### # # # For some reason, however, I can't make the hashes work right. And if you're asking why not just type that into a string, it's because I need to make it randomly do that, and have their exits marked so each path goes somewhere. https://code.sololearn.com/cW28x7VpTRA8/?ref=app

9th Jun 2017, 11:07 PM
Chris L.
2 Answers
+ 14
Try putting commas after the } like this: ways = { allways: { left: True, right: True, up: True, down: True, image:"# #\n \n# #" }, hrzstrt: { left: True, right: True, up: False, down: False, image:"###\n \n###" }, vrtstrt: { left: False, right: False, up: True, down: True, image:"# #\n# #\n# #" }, ulfcrnr: { left: True, right: True, up: True, down: True, image:"###\n# \n# #" } } You might get a new error (that I don't know how to fix) but your old one should be gone xD
9th Jun 2017, 11:45 PM
Jafca
Jafca - avatar
+ 1
first, change True by true and False by false but there is an another bug
12th Jun 2017, 12:49 PM
MBZH31
MBZH31 - avatar