What's All This Stuff About Camels?

When you are programming, you have to give names to things you put in your program so that you can refer to them in your code. But, when writing programs, you are not allowed to use spaces in the name (or your program won't work!). But often it's useful to use more than one word for a name, so camelCase was invented.

Using camelCase, programmers can use more than one word run together but it's stillEasyToReadEvenThoughThereAreNoSpaces.

When you are using Alice, you should use camelCase when naming objects, otherwise your programs often won't work. Why do you think they called it camelCase?

It's always good to give descriptive names to your objects. So if you were putting the two camels above in your Alice program, you might name them:

purpleCamel and orangeCamel

The rules are really quite simple:

1. Your names must start with a lower case letter of the alphabet.

2. You must not use spaces, or other characters like /@#$! in names. (It is not required, but if you use a capital at the start of each new word in the name, it is easier to read.)

3. You can use numbers in the name, but you are not allowed to start with a number.

So purpleCamel1 is ok, but 1purpleCamel is not (because it does not start with a lower case letter).


Take a Quiz to Check Your Understanding



home   left arrow  
right arrow