乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: samifox

[编程交流] cond() - why ((t nill)) is com

[复制链接]

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-5 19:13:33 | 显示全部楼层
No, if the variable s is not equal to either "Y" "y" "N" "n" the t symbol at the end would give you an option to set the variable ( for example ) to any value you want or print a message to user etc...
回复

使用道具 举报

218

主题

699

帖子

483

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1090
发表于 2022-7-5 19:15:01 | 显示全部楼层
So its a defualt action in case none of the expression is true? So its could be (t (prints "illegel value"). So t is just a trigger in endcof the cond?
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
358
发表于 2022-7-5 19:19:15 | 显示全部楼层
Close , have a look .
 
  1. (cond  ((= s "Y") 1)   ((= s "y") 1)   ((= s "N") 0)   ((= s "n") 0)   (t (alert "Variable (s) in not equal to any of the above check outs ")))
回复

使用道具 举报

218

主题

699

帖子

483

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1090
发表于 2022-7-5 19:25:04 | 显示全部楼层
Its not what i meant?
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 19:27:02 | 显示全部楼层
Put simply, a test expression of 't' will always be validated and so this represents a default condition for when all other conditions are not met; such a condition is by no means necessary, but usually provided by the documentation to help explain how to include a default condition.
 
It looks like you understand this.
回复

使用道具 举报

1

主题

80

帖子

73

银币

初来乍到

Rank: 1

铜币
16
发表于 2022-7-5 19:31:02 | 显示全部楼层
The equivalent in another syntax style could be
 
 
if (s=="Y")
    return 1
elseif (s=="y")
    return 1
elseif (s=="N")
    return 0
elseif (s=="n")
    return 0
else
    alert( "Variable (s) in not equal to any of the above check outs ")
endif
 
 
Think of (t ....) as being an all-inclusive "else" or "otherwise".
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-12 19:37 , Processed in 1.207665 second(s), 73 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表