boolean - 如何测试一个条件是否为真?
问题描述
如果我在 Pascal 中有一组布尔变量,我如何测试其中一个是否是True
?
解决方案
在 Pascal 中,您可以这样做:
if Integer(a) + Integer(b) + Integer(c) = Integer(true) then
writeln("exactly one is true");
与 进行比较很重要Integer(true)
,因为它在不同版本的 Pascal 中可能是不同的值。
推荐阅读
- bootstrap-4 - 致命错误 - 检测到 cygheap 基础不匹配 - 0x13A1410/0x13D1410
- datetime - 是否有任何选项可以通过 groovy 读取总项目执行时间
- java - @Transactional 服务方法回滚休眠更改
- node.js - 如何从json文件中读取和写入数据
- reactjs - 如何通过material-ui渲染一个javascript格式的代码片段
- javascript - 在 express-ntlm 中使用 ntlm 直通技术时禁用默认登录提示
- vue.js - 防止父站点样式影响 Vue JS 组件样式
- java - Maven 部署:部署文件工作,但 Maven 部署不工作
- c - 使用指针进行矩阵乘法的问题
- caching - 如何计算缓存未命中?