Professional Documents
Culture Documents
2018
Turbo Pascal
Programming
Body Section
• Consists of the word
Title savings program followed
Section by the name of the
program.
Function Variable
Declarations
Type
Procedure Type
Label
Constant Declaration
Potongan = 2.0000000000-01
Gaji = 25000
Nama = P.T Lali Jiwo
Variable Declaration
Type
Pecahan = real;
Logika = Boolean; bagian defenisi tipe
Bulat = integer;
Huruf = string [25];
Begin
End.
BeginT
Gaji := 50000;
Menikah := true;
JumlahAnak := 3;
Tunjangan := 0.25*Gaji + JumlahAnak * 30000.0;
Total := Gaji + Tunjangan;
Keterangan := ‘Karyawan Teladan’;
Writeln (‘Gaji bulanan : Rp ‘,Gaji);
Writeln (‘Tunjangan : Rp ‘,Tunjangan);
Writeln (‘Total Gaji : Rp ‘,Total);
Writeln (‘Sudah menikah : Rp ‘,Menikah);
Writeln (‘JumlahAnak : Rp ‘,JumlahAnak);
Writeln (‘Keterangan : Rp ‘,Keterangan);
End.
Procedure Declaration
Hasil := x + y ;
End;
{program utama}
Var
Z : integer;
Begin
Tanbah(2,3,z);
Writeln(‘2 +3 =’, Z);
End.
Almost similar to the procedure, but begins with the word backup
function is followed by function names, parameters and function
types. as:
Program Contoh_Fungsi(layer);
Functionr tambah (x,y:integer) : integer;
begin function declaration section
tambah := x + y ;
End;
{program utama}
Begin
Writeln(‘2 +3 =’, Tambah(2,3));
End.