delphi - boolean 计算错误 : Incompatible types

标签 delphi variables boolean delphi-7 pascal

我试图在我的代码中将 boolean 变量 (curs) 设置为 false,但我收到此错误:

[Error] Main.pas(50): Incompatible types

谁知道这是什么意思?

if form1.Left = pt.X and form1.Top = pt.Y
then curs := false;

如果您知道或对发生的事情有任何想法,请随时分享。 :) 谢谢

-connorbp

最佳答案

那是因为你需要在括号之间进行相等性检查,像这样:

if ( form1.Left = pt.X ) and ( form1.Top = pt.Y ) then
  curs := false;

关于delphi - boolean 计算错误 : Incompatible types,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9450424/

相关文章:

java - 常量的命名;先输入还是先命名?

variables - 变量扩展和转义字符

c# - 如何正确使用 automapper 将 bool 映射到枚举?

android - 在 Delphi Firemonkey 移动应用程序中读写 inifile?

delphi - 改善旧系统(尤其是笔记本电脑(Delphi 6))上的Indy HTTP客户端性能?

multithreading - 如何使用 AsyncCalls 调用无参数类过程?

delphi - 最小枚举大小在 Delphi 中不起作用

bash - 如何改进读取变量值并将其写入文件的逻辑?

c++ - 使用 LASlib 时重新定义 BOOL typedef

c++ - C/C++ 中的 bool 是什么?关键字还是宏?