Sophrinix / TryRuby

Try Ruby is a interactive shell that quickly and whimsically teaches the Ruby programming language. Originally _why's idea, it has been recreated from the ground up by Rubyists who have a passion for Ruby and for teaching their fellow (wo)man how to program.
tryruby.org
345 stars 80 forks source link

Popups don't display anything #150

Open Apocryphon opened 12 years ago

Apocryphon commented 12 years ago

For the examples for creating popup windows, creating a popup that displays Google works, but the other ones fail to display anything but a blank popup. Also, there's an example for creating a blog popup entry where only part of the code is given. This is my attempt at it- why doesn't it work?

Popup.make do h1 "MY BLOG" list do blog.each do |entry| h2.entry.title p entry.time p entry.fulltext end end end

re4ctionary commented 12 years ago

Make Sure that your "ends" are lining up with their corresponding lines in terms of indentation

example

$ represents One spacebar tap

Line 1 (Open) $$Line 2 (Open) $$$$Line 3 (Open) $$$$end (This end lines up with Line 3; therefore closes that line) $$end (This end lines up with Line 2; therefore closes that line) end (This end lines up with Line 1; therefore close that line)

(note: 2nd level indentation are 2 spaces; 3rd level indentation are 4 spaces... in so far as this tutorial is concerned)

Note: I don't know if this matters outside the "TryRuby.org" environment- however, that being said, it's good practice; that way it's easy to see when you missed an end (especially when your code gets longer).

Best, R

MajorGrooves commented 12 years ago

I thought indentation's only purpose was to make it easier to keep track of code blocks, rather than have any real effect on the code - i.e. it should run the same with or without indentation.

re4ctionary commented 12 years ago

I'm only addressing the issue as it relates to "TryRuby.org." I don't think it's critical outside of the learning environment- however, if you want to get through the lesson; it may be a convention you need to follow in order to complete the section.