Article by:
Date Published:
Last Modified:


Delphi grew out of the Turbo Pascal language.

Delphi is one of the languages available for writing scripts in Altium, a PCB design program.

Code Blocks

Delphi uses begin and end; keywords to create blocks of code (similar to the { and } characters in c).

Note that after the end keyword you must include a semi-colon, but

The Delphi logo.
The Delphi logo.

not after the begin keyword!


Binary Arithmetic

=  // Equal to
<> // Not equal too


Single line comments are started with // and finish on the start of a new line.

Multi-line comments are started with either { or (* and finished with } or *).


Rounding in Delphi can be done with the in-built function Round(). It rounds a number to the nearest integer. To round to a specified number of decimal places, you can use this function in conjunction with the divide/multiply technique.

Divide the number by the precision you want, use the Round function, and then multiply it again by the precision.

// Rounds a value to 2 decimal places
procedure RoundAValueTo2Dp();
    unRoundedValue : double;
    roundedValue : double;
    unRoundedValue := 2.4798;
    roundedValue := Round(unRoundedValue/0.01)*0.01;
    // roundedValue now equals 2.48


Geoffrey Hunter

Dude making stuff.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License .


    comments powered by Disqus