Hello World
class HELLO_WORLD is main is #OUT+"Hello World\n"; end; end;A few remarks:
- Class names are ALL CAPS; this is not only a convention but is enforced by the compiler.
- The method called
mainis the entry point for execution. It may belong to any class, but if this is different fromMAIN, it must be specified as a compiler option. #is the constructor symbol, calling methodcreateof the corresponding class; here it is used for instantiating theOUTclass, which is actually stdout.- The
+operator has been overloaded here to stand for stream append. - Operators such as
+are syntactic sugar for conventionally named method calls:a + bstands fora.plus(b). The usual arithmetic precedence conventions are used to resolve the calling order of methods in complex formulae. - The program layout allows for pre- and post-conditions (not shown here), showing Sather's Eiffel lineage.
Read more about this topic: Sather
Famous quotes containing the word world:
“A part, a large part, of travelling is an engagement of the ego v. the world.... The world is hydra headed, as old as the rocks and as changing as the sea, enmeshed inextricably in its ways. The ego wants to arrive at places safely and on time.”
—Sybille Bedford (b. 1911)
“The base of all artistic genius is the power of conceiving humanity in a new, striking, rejoicing way, of putting a happy world of its own creation in place of the meaner world of common days, of generating around itself an atmosphere with a novel power of refraction, selecting, transforming, recombining the images it transmits, according to the choice of the imaginative intellect. In exercising this power, painting and poetry have a choice of subject almost unlimited.”
—Walter Pater (18391894)