[Udemy] Learn to program with pascal

Visits: 0

新的工作內容是把 pascal 語法,轉為 python 語法,本文紀錄在 udemy 上學習 pascal 的筆記。

Section 1: Getting started

5. Installing the software

pascal 的開發工具有付費版本的 Delphi 與免費版本的 Lazarus ,這邊使用 Lazarus 來開發,到這個連結下載 Lazarus 來開發。

8. A quick tour of Pascal code

Pascal 是物件導向的語言,物件所有的三大特性(封裝、繼承、多型)他都有。

unit: scrip 名稱。

interface: class, object…等,這邊舉例是 form 這個 class。也可以在 interface 中透過 uses 指令來呼叫別的 unit。

implementation: actual executor code is written。

單行註解用 // ,多段註記用 {} 包起來

interface 要先定義好 method (行為),才能夠在 implementation 呼叫並執行。

其他語法

procedure TForm1.PrintHello(TL: TList);
begin
    DisplayBox.lines.print('Hello')
end

procedure 代表的是某個 function,底下可透過 begin...end 來執行多段指令,並且使用 ; 作為一行指令的結束。

:=: 表示指派變數

About the Author

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

You may also like these