Turbo Pascal - Sample Code

Sample Code

  • Pascal is not case sensitive.
  • Historically, Pascal comments are enclosed { within pairs of braces }, or (* left parenthesis/asterisk and asterisk/right parenthesis pairs *), and these can span any number of lines. Later versions of Borland Pascal also supported C++-style comments // preceded by two forward slashes, which finish at the end of the line.
  • The syntax for the statement case is more flexible than standard Pascal.
  • Sets may only have up to 256 (28) members.
  • Standard, fixed-length Pascal strings are supported, but there is also a more flexible String type.

This is the classic Hello world program in Turbo Pascal:

program HelloWorld; begin WriteLn('Hello World') end.

This asks for a name and writes it back to the screen a hundred times:

program WriteName; var i : Integer; {variable to be used for looping} Name : String; {declares the variable Name as a string} begin Write('Please tell me your name: '); ReadLn(Name); {ReadLn returns the string entered by the user} for i := 1 to 100 do begin WriteLn('Hello ', Name) end end.

Read more about this topic:  Turbo Pascal

Other articles related to "sample code, code":

CMS EXEC - Sample Code
... A simple PROFILE EXEC might look like the following * The following code issues CMS commands to set * the "blip" character to asterisk and request * the "short" format for system ready ...

Famous quotes containing the words code and/or sample:

    Hollywood keeps before its child audiences a string of glorified young heroes, everyone of whom is an unhesitating and violent Anarchist. His one answer to everything that annoys him or disparages his country or his parents or his young lady or his personal code of manly conduct is to give the offender a “sock” in the jaw.... My observation leads me to believe that it is not the virtuous people who are good at socking jaws.
    George Bernard Shaw (1856–1950)

    As a rule they will refuse even to sample a foreign dish, they regard such things as garlic and olive oil with disgust, life is unliveable to them unless they have tea and puddings.
    George Orwell (1903–1950)