作者godfat (godfat 真常)
看板java
标题Re: [问题] 有关boolean
时间Wed Jan 3 09:01:30 2007
※ 引述《aaa12345 (一肩担鸡双头啼)》之铭言:
: 请问我该怎麽作 找了半天找不到将int 转为 boolean 的method
edited: 感谢 chrisho 指正
其他的有人回答了,至於把 int 转为 boolean?
如果只是要用像 C/C++ 的用法,多个 == 判断就好了,
根本不需要做什麽转换吧|||b
不用想得那麽复杂…
if( (4&1) != 0 ) 就好了
非 0 都是 true, 不是吗?
--
In Lisp, you don't just write your program down toward the language,
you also build the language up toward your program.
《Programming Bottom-Up》- Paul Graham 1993
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.217.102.100
※ 编辑: godfat 来自: 125.232.1.111 (01/03 18:22)