Re: [問題] 有關boolean
※ 引述《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)
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 4 之 7 篇):