Caps in Getting Technical?


I was just wondering why the "Books" part of firstBook and secondBook are capitalized. Maybe this is an amateur question, but I would like to know.

 = ["Charlie and the Chocolate Factory", "War and Peace", "Utopia", "A Brief History of Time", "A Wrinkle in Time"]

# To sort our books in ascending order, in-place
books.sort! { |firstBook, secondBook| firstBook <=> secondBook }

# Sort your books in descending order, in-place below

books.sort! { |secondBook, firstBook| firstBook <=> secondBook }


In coding circles this is known as camelCase. Another convention often seen in Python is, snake_case.

Both cases permit multiple terms in a name without spaces (which are not valid in a variable name).


Very helpful! Thank you so much!!!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.