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:
“That the world is not the embodiment of an eternal rationality can be conclusively proved by the fact that the piece of the world that we knowI mean our human reasonis not so very rational. And if it is not eternally and completely wise and rational, then the rest of the world will not be either; here the conclusion a minori ad majus, a parte ad totum applies, and does so with decisive force.”
—Friedrich Nietzsche (18441900)
“Youth enters the world with very happy prejudices in her own favour. She imagines herself not only certain of accomplishing every adventure, but of obtaining those rewards which the accomplishment may deserve. She is not easily persuaded to believe that the force of merit can be resisted by obstinacy and avarice, or its lustre darkened by envy and malignity.”
—Samuel Johnson (17091784)