Code Editor
Learn
Object-Oriented Programming I

Class Syntax

A basic class consists only of the class keyword and the name of the class. Check it out:

class NewClass # Class magic here end

Our NewClass has the ability to create new Ruby objects of class NewClass (just like "Hello!" is a String and 4 is a Fixnum). By convention, class names start with a capital letter and use CamelCase instead of relying_on_underscores.

Report a Bug
If you see a bug or any other issue with this page, please report it here.