Perfect Developer basic tutorial 1 This page last modified 2011-10-29 (JAC)

Introducing Perfect

A Perfect source file contains identifiers, reserved words, symbols, literals and various kinds of white space. Here we will introduce the forms of identifiers allowed, the related details that you will need to know, and the significance of the symbols used.

Rules about identifiers

In Perfect, identifiers are case-sensitive and consist of any number of letters, digits and the underscore character.

However, if you are compiling to C++, bear in mind that some C++ implementations place a limit on the number of significant characters, particularly for identifiers that are declared in one module and referred to in another.

Many object-oriented developers use identifiers that start with an uppercase letter for classes, and identifiers starting with lowercase letters for variables, methods and parameters. You may use this convention if you wish, even though it is always clear in Perfect whether or not an identifier refers to a class.

Words not allowed as identifiers!

You may not use a reserved word, such as value or change, as an identifier. A complete list of reserved words is given in Chapter 3.6 of the Language Reference Manual (opens in a new window), which you might wish to keep open while you're working through the tutorial.

White space

Spaces, newlines (i.e. carriage return and/or linefeed characters) and tab characters are known collectively as white space. Apart from one exception, white space serves only to separate adjacent tokens (i.e. reserved words, identifiers and symbols) and it is otherwise ignored. The exception is that newline also terminates a comment.

Knowledge round-up quiz

Next:  Symbols

 

Save My Place Glossary Language Reference Manual
Tutorials Overview Main site   
Copyright © 1997-2012 Escher Technologies Limited. All rights reserved. Information is subject to change without notice.