首页 > 代码库 > if语句,case语句

if语句,case语句

1、句式:if...then.判断赋值

例:

if RadioButton1.Checked then
sex:=‘男‘
else if RadioButton2.Checked then
sex:=‘女‘

2、case...of

...

end;

例:

case RadioGroup1.ItemIndex of
0:grade:=‘优‘;
1:grade:=‘良‘;
2:grade:=‘中‘;
3:grade:=‘差‘;
end;

 

if语句,case语句