Skip to content

Instantly share code, notes, and snippets.

@Alemiz112
Last active June 2, 2021 19:13
Show Gist options
  • Save Alemiz112/c3a89c2889e96227699f788f1eae82d6 to your computer and use it in GitHub Desktop.
Save Alemiz112/c3a89c2889e96227699f788f1eae82d6 to your computer and use it in GitHub Desktop.
Pascal Syntax

Logical operators

  • smaller: <
  • greater: >
  • equal: =
  • not equal: <>

Variables

var
 index : Integer;

Type conversions

  • StrToInt(), IntToStr(), RGBToColor(r, g, b)

Loading variables from Edit

  • value := Edit1.Text

Common Lazarus Methods

  • Reset image: Image1.Canvas.FillRect(Image1.ClientRect)
  • Render ellipse on image: Image1.Canvas.Ellipse(x1, y2, x2, y2)
  • Render rectangle on image: Image1.Canvas.Rectangle(x1, y2, x2, y2)
  • Change font size: Image1.Canvas.Font.Height := size
  • Change pen color: Image1.Canvas.Pen.Color := color
  • Change font color: Image1.Canvas.Font.Color := color
  • Change brush color: Image1.Canvas.Brush.Color := color
  • Print out text on image: Image1.Canvas.TextOut(x, y, string)
  • Change brush style: Image1.Canvas.Brush.Style := style

Functions

procedure shitMethod(SleepTime: LongInt);
begin
  // Your shit here
end;

Loops

Simple loop (i increases)

for i:=1 to 10 do
 begin
  // Your code here
 end;

While loop

while true do
 begin
  // Your code here
 end;

Useless decrease loop

for i:=9 downto 0 do
 begin
  // Your code here
 end;

Conditions

Simple Condition

if YourStatement then
  invokeYourMethod();

Standard Condition

if YourStatement then
begin
  // Your shit here
end;

Two-way Condition

if YourStatement then
begin
  // Your shit here
end
else
begin
  // Your shit here
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment