





Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Esta página não é visível na pré-visualização
Não perca as partes importantes!






Sintaxe: AnsiLowerCase(const S: string): string;
Exemplo: Procedure Tform1.Button1Click(Sender: TObject); Var X:String; Begin X:=Label1.caption; Label1.caption:= AnsiLowerCase(X); { Label1 ficará tudo em letras minúsculas } End;
Sintaxe: AnsiUpperCase(const S: string): string;
Exemplo: Procedure Tform1.Button1Click(Sender: TObject); Var X:String; Begin X:=Label1.caption; Label1.caption:= AnsiUpperCase(X); { Label1 ficará tudo em letras maiúsculas } End;
Sintaxe: Break;
Exemplo: Procedure Tform1.Button1Click(Sender: TObject); var S: String; begin While true Do
begin S := Edit1.text; If S = ' ' Then Break ; { Interrompe o loop } Label1.Caption := S; end; end;
Sintaxe: CloseFile(var F);
Exemplo: Procedure Tform1.Button1Click(Sender: TObject); var F: TextFile; begin if OpenDialog1.Execute then begin AssignFile(F, OpenDialog1.FileName); Reset(F); Edit1.Text := Str(FileSize(F)); CloseFile(F) ; { Fecha o arquivo } end; end;
Sintaxe: Continue;
Exemplo: Procedure Tform1.Button1Click(Sender: TObject); var S: String; begin While true Do begin S := Edit1.text; If S = ' ' Then Continue ; { Voltará para o próximo loop } Label1.Caption := S; end; end;
Sintaxe:
MyFileHandle := FileOpen(EXISTS.TXT) ; { Abre o arquivo EXISTS.TXT } end;
Sintaxe: GotoXY(X, Y: Byte);
Exemplo: Procedure Tform1.Button1Click(Sender: TObject); begin GotoXY(10,25) ; { Posiciona o ponteiro do mouse no pixel 10 , 25 } end;
Sintaxe: Int(X: Real): Real;
Exemplo: Procedure Tform1.Button1Click(Sender: TObject); var R: Real; begin R := Int(123. 456) ; { Mostra “123.0” } R := Int(-123.456) ; { Mostra “-123.0” } end;
Sintaxe: KeyPressed: Boolean;
Exemplo: Procedure Tform1.Button1Click(Sender: TObject); var A,B:integer; begin B:=1; repeat A:=A+B; Label1.Caption := str(A); until KeyPressed ; { Repetirá até alguma tecla ser pressionada } end;
Sintaxe: { Formato da data e hora } Now: TDateTime;
Exemplo: Procedure TForm1.Button1Click(Sender: TObject); begin Label1.Caption := 'A data e hora é ' + DateTimeToStr( Now ); { Mostra a hora e data } end;
Sintaxe: Sqr(X: Real): (Real);
Exemplo: Procedure Tform1.Button1Click(Sender: TObject); var S, Temp: String; begin Str( Sqr(5.0) :2:1, Temp); { Retorna 25.0 } S := '5 ao quadrado é ' + Temp; MessageDlg(S, mtInformation, [mbOk], 0); end;
Sintaxe: Str(X [: Width [: Decimals ]]; var S);
Exemplo: Procedure Tform1.Button1Click(Sender: TObject); var X, Temp: String; A: Integer; begin A:=A+ Str(A:2:1, Temp) ; { Transforma A em string de tamanho dois e uma casa decimal } X := 'O número é ' + Temp; MessageDlg(X, mtInformação, [mbOk], 0); end;
begin tecla := Edit1.text; Case tecla of ‘A’..’Z’, ‘a’..’z’:Label2.caption:=‘Você digitou uma letra’; {Executa se digitado uma letra} ‘0’..’9’:Label2.caption:=‘Você digitou um número’ { Executa se digitado um número } else Label2.caption:=‘Você digitou um caracter especial’; { Executa se digitado outra tecla } end;
Sintaxe : Repeat
Exemplo : Procedure Tform1.Button1.Click(Sender: TObject); var a, b : integer; begin b := 1; Repeat a := a + b; Label3.caption := str (a) + str(b); until a = 1000; { Se a <> de 1000 , senão } end;
Sintaxe: While <expressão> do
Exemplo: Procedure Tform1.Button1Click(Sender: TObject); var a, b : integer; begin b := 1; While a < 1001 Do { Enquanto a for < que 1001 executa o bloco, senão } begin a := a + b; Label3.caption := str (a) + str(b); end; end;
Sintaxe: For <variável de controle> :=
Sintaxe: Goto <rótulo>; Label <rótulo>;
Exemplo: Procedure Tform1.Button1Click(Sender: TObject); var resp : char; a, b : integer begin b := 1; Label inicio: { A linha é rotulada como inicio } a := a +b; Label2.caption := str(a); Label3.caption := ‘Deseja somar mais um’; Edit1.visible := True; resp := Edit1.text; If (resp = ‘S’ or ‘s’ or ‘Y’ or ‘y’) then Goto inicio; { Volta para o rótulo } end;
Sintaxe: RunError [ ( Errorcode: Byte ) ];