关于IF语句 (50分)

N

nfy

Unregistered / Unconfirmed
GUEST, unregistred user!
if 语句可以这么写吗
if CheckBox1.State=cbChecked and CheckBox2.State=cbChecked and CheckBox3.State=cbChecked then
 
可以这么写
 
if (CheckBox1.State=cbChecked) and (CheckBox2.State=cbChecked) and (CheckBox3.State=cbChecked) then


if CheckBox1.Checked and CheckBox2.Checked and CheckBox3.Checked then
 
对啦,每一个关系式要使用()括号的!
 
但为何编译不能通过啊
[Error] SQL.pas(52): Operator not applicable to this operand type
 
if (CheckBox1.State=cbChecked) and (CheckBox2.State=cbChecked) and (CheckBox3.State=cbChecked) then
 
Pascal 的表达式, and 优先于 =
if CheckBox1.State=cbChecked and CheckBox2.State=cbChecked and CheckBox3.State=cbChecked then
首先解释 cbChecked and CheckBox2.State, 就通不过
 
原来这么简单啊
 

Similar threads

顶部