Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Semicolons in Delphi

Shulou Source: shulou.com Published: 2022-06-03 06:10:30 10月05日 Update

A semicolon in Delphi indicates the end of a statement. As a novice, I often make mistakes like this:

1. In a conditional judgment statement, a semicolon is used in the middle

As follows:

It's not necessary to write in the red circle in the picture. If you write a semicolon, the following statement becomes else if....

Note: the above code can be replaced with the following code:

Procedure TForm1.btn1MouseDown (Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer); const s: Array [0.. 2] of string= ('left button', 'right button', 'middle button'); beginshowmessage (sord (button)]); mbleft;end;end.

Tags: Semicolon statement code necessary circle comment regular meeting novice condition red face figure Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Microsoft Docker Shulou Information OPPO Reno