Difference between revisions of "As"
From Lazarus wiki
Jump to navigationJump to search (Initial try at describing AS needs clearer less complex looking example!) |
(→As: typo) |
||
Line 3: | Line 3: | ||
− | The [[Keyword|keyword]] '''as''' is used to cast (use one variable type as | + | The [[Keyword|keyword]] '''as''' is used to cast (use one variable type as if it were another type) |
<syntaxhighlight> | <syntaxhighlight> |
Revision as of 08:31, 18 September 2012
As
The keyword 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 a Pascal language extension