May 2004
Intermediate to advanced
888 pages
22h 31m
English
This section compares if and case constructs in Delphi to similar constructs in C# and Visual Basic .NET. We assume that you’ve used these types of programmatic constructs before, so we don’t spend much time explaining them to you.
An if statement enables you to determine whether certain conditions are met before executing a particular block of code. As an example, here’s an if statement in Delphi, followed by equivalent definitions in C# and Visual Basic .NET:
{ Delphi }
if x = 4 then y := x;
/* C# */
if (x == 4) y = x;
'Visual Basic
If x = 4 Then y = xNote
If you have an if statement that makes multiple comparisons, make sure that you enclose each set of comparisons in parentheses for code clarity. Do this: ...
Read now
Unlock full access