Difference between revisions of "As"

From Lazarus wiki
Jump to navigationJump to search
(Have been deleted explicit category for prevent copying it to new translations. This category already included in "Template:as" for all languages.)
Line 1: Line 1:
 
{{as}}
 
{{as}}
== As ==
 
  
  
The [[Keyword|keyword]] '''as''' is used to cast (use one variable type as if it were another type)
+
The [[Reserved word|reserved word]] <syntaxhighlight lang="pascal" enclose="none">as</syntaxhighlight> is used to cast (use one variable type as if it were another type)
  
 
<syntaxhighlight>
 
<syntaxhighlight>
Line 12: Line 11:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
here the Sender variable of type TObject is being cast as type TDBGrid
+
here the Sender [[Variable|variable]] of [[Type|type]] [[TObject]] is being cast as type [[TDBGrid]]
  
As is an Object Pascal and a Borland Delphi extension.
+
<syntaxhighlight lang="pascal" enclose="none">As</syntaxhighlight> is an [[Object Pascal]] and a Borland [[Delphi]] extension.

Revision as of 22:16, 20 March 2019

Deutsch (de) English (en) español (es) suomi (fi) français (fr)


The reserved word as is used to cast (use one variable type as if it were another type)

procedure TmainForm.selectionGridDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
     (Sender As TDBGrid).DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;

here the Sender variable of type TObject is being cast as type TDBGrid

As is an Object Pascal and a Borland Delphi extension.