Classes

Download ruby eBook

Syntax

  • class Name
  • #some code describing the class behavior
  • end

Remarks

Class names in Ruby are Constants, so the first letter should be a capital.

class Cat # correct
end  

class dog # wrong, throws an error
end

Related Examples

Stats

276 Contributors: 19
Monday, January 23, 2017
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook