Skip to Content
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.



Create a class called Person in the editor. Don’t put anything between class Person and end just yet.

Folder Icon

Take this course for free

Already have an account?