30 Aug '15, 10am

@jasim_ab The only exercise on this page returns "Oops..." every time. I need my completion!

Example Code: class Item def initialize(item_name, qty) @item_name = item_name @qty = qty end end item = Item.new("a",1) puts item p item [reset] Need a hint? See the Solution Hint Output Window As you can see, puts prints the class name of the object along with a number displayed as hex. The number is relative to the position of the object in memory, but we seldom find any use for it. p on the other hand prints the class name and all the instance variables of the object. This can be very useful while debugging. The above example illustrated the default behaviour of p and puts . But there will be occasions when you'd want to customize what these methods display. This is easily done by overriding the to_s method. In the following exercise, override the to_s method of the Item class so that it returns a string with both the item's name and quantity. class Item def initialize...

Full article: https://rubymonk.com/learning/books/4-ruby-primer-ascent/...

Tweets

Storied airborne unit returns to Europe for @NA...

stripes.com 27 Aug '15, 1am

View Photo Gallery » A V-22 Osprey takes off after dropping off a group of American, Italian and German special operation ...

Storied airborne unit returns to Europe for @NA...

stripes.com 26 Aug '15, 8pm

View Photo Gallery » A V-22 Osprey takes off after dropping off a group of American, Italian and German special operation ...

Storied airborne unit returns to Europe for NAT...

stripes.com 26 Aug '15, 6pm

View Photo Gallery » A V-22 Osprey takes off after dropping off a group of American, Italian and German special operation ...