
请教 delphi的if语句中的or或and语句怎么用啊?
2个回答
展开全部
or:
if后的条件只要有一个为真就执行if后的语句
例: if (1<0) or (2>1) then showmessage('Test'); //2>1为真执行
and:
if后的所有条件都为真才执行if后的语句
例: if (1<0) or (2>1) then showmessage('Test'); //1<0为假不执行
这下就可以了..忘加括号了
if后的条件只要有一个为真就执行if后的语句
例: if (1<0) or (2>1) then showmessage('Test'); //2>1为真执行
and:
if后的所有条件都为真才执行if后的语句
例: if (1<0) or (2>1) then showmessage('Test'); //1<0为假不执行
这下就可以了..忘加括号了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询