下面的 if 语句可以转换为 case 语句吗?
if (Number >= 5) and (Number <= 10) then
lblAnswer.Caption := 'in range'
else
lblAnswer.Caption := 'out of range';
我的答案 :
是的,它可以
case (number >= 5) and (Number <= 10) of
lblAnswer.Caption := 'in range';
lblAnswer.Caption := 'out of range';
end;
这个对吗?