Penguin

Differences between version 20 and previous revision of Pascal.

Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History

Newer page: version 20 Last edited on Wednesday, July 4, 2007 1:26:03 pm by GlynWebster Revert
Older page: version 19 Last edited on Thursday, March 31, 2005 11:36:47 am by GlynWebster Revert
@@ -1,25 +1,27 @@
 An imperative ProgrammingLanguage designed by NicolasWirth as a teaching language. Once very popular in schools before students started whining that they wanted to learn [C]. The ancestor of the language in [Borland]'s [Delphi] and [Kylix] [GUI] development environments, which added ObjectOrientation. 
  
 !!! A Sample 
  
- __ function__ plural (noun : __ string__ ) : __ string__ ;  
- { Returns the plural version of a noun. }  
- __ var__  
- i : integer;  
- __ begin__  
- __ case__ noun[[length(noun)] __ of__  
- 's': __ if__ noun[[length(noun)-1] = 'e' __ then__  
- plural := noun  
- __ else__  
- plural := noun + 'es';  
- 'y': __ begin__  
- delete(noun, length(noun), 1);  
- plural := noun + 'ies';  
- __ end__ ;  
- __ else__ plural := noun + 's';  
- __ end__ ;  
- __ end__ ; {plural} 
+<verbatim>  
+ function plural (noun : string) : string;  
+ { Returns the plural version of a noun. }  
+var  
+ i : integer;  
+begin  
+ case noun[[length(noun)] of  
+ 's': if noun[[length(noun)-1] = 'e' then  
+ plural := noun  
+ else  
+ plural := noun + 'es';  
+ 'y': begin  
+ delete(noun, length(noun), 1);  
+ plural := noun + 'ies';  
+ end;  
+ else plural := noun + 's';  
+ end;  
+end; {plural}  
+</verbatim>  
  
 (This is in the TurboPascal dialect of Pascal.) 
  
 !!! History