![]() |
|
What's wrong with my Ruby code? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5) +---- Thread: What's wrong with my Ruby code? (/showthread.php?tid=4915708) |
What's wrong with my Ruby code? - Auxil - Jul 21, 2015 I have been playing around on CodeCademy with some Ruby since yesterday, and I feel as though I am grasping it slightly, but a few issues are becoming visible. What is wrong with this code? I keep getting an error: Code (ruby):15: syntax error, unexpected $end, expecting keyword_endCode: Code print "What grade did you get on your final?"Thanks. It's always the simplest of issues that stump me.. EDIT: I fixed it by doing this: Code print "What grade did you get on your final?"* - scam. - Jul 21, 2015 http://pastebin.com/1hpXqKEX * - Auxil - Jul 21, 2015 (Jul 21, 2015 08:30 AM)Mael Wrote: http://pastebin.com/1hpXqKEX Thanks man! I ended up fixing it 20 mins later, but didn't realize you could substitute "puts" with p. You know you don't have to use several #'s for a multi-line comment? Just use: Code =beginBut still, thanks man! These tips are really helpful! * - scam. - Jul 21, 2015 (Jul 21, 2015 01:48 PM)Auxil Wrote: Thanks man! I ended up fixing it 20 mins later, but didn't realize you could substitute "puts" with p. I just think the #s look better. 🙂 just as easy to add with vim too. * - Auxil - Jul 21, 2015 (Jul 21, 2015 08:19 PM)Mael Wrote: I just think the #s look better. 🙂 just as easy to add with vim too. Yeah. Thanks man. What can I do with Ruby? I can't figure out how to implement a script into a webpage. Is that even possible? I really want to do something with Ruby, so I can stay interested in it. I lose interest extremely fast, which is horribly annoying for me. I really want to focus on one thing, but it's very hard. Thanks. * - scam. - Jul 22, 2015 (Jul 21, 2015 11:43 PM)Auxil Wrote: Yeah. Thanks man. For websites you should look at something like Ruby on Rails. I have only looked into it a little bit but it is an extrememly solid framework for making websites using ruby. As for stuff to do, I mostly use it for automation and making small scripts to make my life easier. For example scraping web pages, processing lists, creating files/directories, etc. Just recently I made a script using the tinypng api to optimize images. Just stuff like that mostly. If you're interested in making web applications definitely take the time to learn RoR. It will take a bit to get used to but it is very powerful. There is even a course on CodeAcadamy. https://www.codecademy.com/courses/learn-rails * - Auxil - Jul 22, 2015 (Jul 22, 2015 12:18 AM)Mael Wrote: For websites you should look at something like Ruby on Rails. I have only looked into it a little bit but it is an extrememly solid framework for making websites using ruby. I was planning to finish the Ruby course before attempting Rails. Currently like 25% done with the course. About three days in, and a few hours each day working on it, plus some buffer time when I have issues with my code, or get distracted. * - severos - Jul 22, 2015 (Jul 22, 2015 01:25 AM)Auxil Wrote: I was planning to finish the Ruby course before attempting Rails. Currently like 25% done with the course. About three days in, and a few hours each day working on it, plus some buffer time when I have issues with my code, or get distracted. Personally I learned Sinatra+ActiveRecord before Rails, because I just couldn't get the idea of this whole MVC part, however soon as I started making a little big projects I understood it and switching to Rails wasn't that big problem, it actually makes big code easier to split and security much much easier to implement. However if you're going for small testing stuff Rails will be over kill. Try to expand the number of tools you can use and make sure you know which one is suitable for what stuff. On a side note, you can try making games with Ruby, there's a gem Gosu that helps you, and you can try making Android apps if you google around (because I forgot the names <.<) |