Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Turbo Pascal
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Syntax == * Pascal is not [[case-sensitive]]. * Historically, Pascal comments are enclosed <code>{ within pairs of braces }</code>, or <code>(* left parenthesis/asterisk and asterisk/right parenthesis pairs *)</code>, and these can span any number of lines. Later versions of Borland Pascal also supported C++-style comments <code>// preceded by two forward slashes </code>, which finish at the end of the line. * The syntax for the statement <code>case</code> is more flexible than standard Pascal. * Sets may only have up to 256 (2<sup>8</sup>) members. * The standard Pascal <code>String</code> preceded by a length byte is supported, and takes a fixed amount of storage; later versions added a more flexible null-terminated type, calling the older type "short string". Older source code which handles strings in non-standard ways (e.g., directly manipulating the length byte like <code>S[0]:=14</code> to truncate a string) must either have its strings declared as short strings, or be rewritten. This is the classic [["Hello, World!" program]] in Turbo Pascal: <syntaxhighlight lang="Pascal"> program HelloWorld; begin WriteLn('Hello World') end. </syntaxhighlight> This asks for a name and writes it back to the screen a hundred times: <syntaxhighlight lang="Pascal"> 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; readln; end. </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)