| { |
Begin |
|
| } |
End |
|
| = |
:= |
Becomes |
| == |
= |
Equal |
| / |
/ |
Division (or sometimes div) |
| % |
Mod |
Modulo operation |
| ! |
Not |
|
| != |
<> |
Not equal |
| && |
And |
|
| || |
Or |
|
| ^ |
Xor |
|
| >> |
Shr |
bit shift right |
| << |
Shl |
bit shift left |
| ++ |
Inc |
|
| -- |
Dec |
|
| /* |
{ |
Comment start |
| /* |
(* |
Comment start |
| */ |
} |
Comment end |
| */ |
*) |
Comment end |
| // |
// |
End of line comment (only one line comment) |
| #define |
{$Define } |
|
| #define |
{$SetC } |
Mac Pascal |
| #elif |
|
|
| #else |
{$Else} |
|
| #else |
{$ElseC } |
Mac Pascal |
| #endif |
{$EndIf } |
|
| #endregion |
|
|
| #error |
{$Fatal } |
|
| #if |
{$If } |
|
| #if |
{$IfC } |
Mac Pascal |
| #ifdef |
{$IfDef } |
|
| #ifndef |
{$IfNDef } |
|
| #pragma |
{$IfOpt } |
|
| #region |
|
|
| #undef |
{$Undef } |
|
| #warning |
{$Hint } |
|
| public static void Main(string[] args) { } |
Program ; Begin End. |
Note the period after End |
| []; |
: Array Of ; |
|
| [#]; |
: Array[#..#] Of ; |
|
| null |
Nil |
|
| abstract |
Abstract |
|
| break |
Break |
|
| class { } |
= Class End; |
Delphi OOP |
| class { } |
= Object End; |
Turbo Pascal OOP |
| class <T> { } |
Generic = Class<T> End; |
Generics are classes only as of 2.2.2, likely to support more in the future |
| Class() |
Constructor |
Constructor name is by convention either Init or Create |
| continue |
Continue |
|
| do while |
Repeat Until Not |
|
| do while ! |
Repeat Until |
|
| enum { } |
= (# .. #); |
|
| enum = { = #, } |
= ( = #, ); |
|
| TheEnum enumVar; |
:= Set Of ; |
|
| class : |
= Class(TObject) |
|
| const |
Const |
for constants, not uninheritables |
| for( = ; ; ++) |
For To Do |
|
| for( = ; ; --) |
For Downto Do |
|
| foreach( in ) |
For In |
For .. in loop |
| if() |
If Then |
|
| if() else |
If Then Else |
|
| using |
Uses |
|
| interface { } |
= Interface(IInterface) End; |
|
| new [#]; |
SetLength( , #); |
|
| new (); |
:= .Create; |
|
| namespace Name { } |
Unit ; Interface Implementation End. |
Note the period after End |
| out |
Out |
|
| override |
Override |
|
| private |
Private |
|
| protected |
Protected |
|
| public |
Public |
|
| ref |
Var |
|
| return |
FunctionName := |
|
| return |
Result := |
ObjFPC or Delphi modes |
| sealed |
sealed |
starting from fpc 2.5.1 |
| static |
Static |
|
| static |
Class Function |
|
| static |
Class Procedure |
|
| struct { } |
= Record End; |
|
| base |
Inherited |
Parent constructor call |
| switch () { case: break; } |
Case Of End ; |
|
| switch() { case: break; default: } |
Case Of Else End |
|
| this |
Self |
|
| try { } catch |
Try except |
|
| try { } catch finally |
Try Finally |
|
| unsafe |
|
|
| virtual |
Virtual |
|
| void |
Procedure |
|
| volatile |
|
|
| while |
While Do |
|
| |
Asm End; |
|