Pascal versus C/Java

statement typePascal C/Javacomments
declarationsi, n: integer;
type foo20 = array[1..20] of integer;
var P: foo20;
int i, n;
int P[20];
Pascal array details
not important
assignmentx := x + 5;x = x + 5;beware: C's "=" doesn't
mean "equals" !
if statementif i=n then x:=17
else x:=23;
if (i==n) x=17;
else x=23;
C condition needs parens,
uses == to mean equals
while loopwhile P[i]>=b do i:=i+j;while (P[i]>=b) i=i+j;C has no "do"
groupingbegin
x:=4;
i:=i+1
end
{
x=4;
i=i+1;
}
insides should be indented
for loopfor i:=0 to n-1 do
begin . . . end
for (i=0; i<n; i=i+1)
{ . . . }
-
comments{a helpful comment}\\ a helpful comment-