Delphi VS C ++ of Syntax (2) Select Structure

zhaozj2021-02-16  70

IF statement:

Delphi:

IF B> a life begin A: = C; c: = d; // If there is only one statement, do not need becom..end, d: = a; //, it cannot be added; END / / There is an else statement below After this statement, it can't be ";"! Else C: = 'asdf'; // End! Multiple statements use begin..nd ;! Edit1.Text: = D; ...

C case:

IF (...) {...} else {...}

Note: The compilation switch {$ b} is used in Delphi to control the two evaluation methods to select the default to {$ b-}, that is, the partial evaluation method is used. When {$ B }, full evaluation methods will be used.

CASE statement:

Delphi:

Case Trunc (X / 10) of 0: Y: = X; 1: Y: = 0.95 * x; 2: Y: = 0.90 * x; // This middle multiple statements do not need Begin..nd! Else Y: = 0.8 * x; end; // The end of the statement ends;! ...

C case:

Switch (x / 10) {case 0: y = x; Case 1: y = 0.95 * x; case 2: y = 0.90 * x; default: y = 0.80 * x;} ...

One contrast, C grammar is significantly more than Delphi syntax, and the Delphi write code is accidentally written out of the format.

转载请注明原文地址:https://www.9cbs.com/read-16812.html

New Post(0)