看板 Visual_Basic 關於我們 聯絡資訊
dim a(9) as integer msgbox isempty(a(0)) msgbox a(0) 運行結果是"False" 跟 "0" 請問array宣告後的初始值是否為0?且不是empty? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.173.161.237 ※ 文章網址: http://www.ptt.cc/bbs/Visual_Basic/M.1398780956.A.665.html
tsongs:因為你宣告是integer吧 04/30 06:24
所以VBA宣告integer初始值會是0? ※ 編輯: gecer (111.255.233.239), 05/01/2014 07:43:36
fumizuki:數值型態的變數的初始值都是0,字串的初始值是空字串 05/01 12:56
fumizuki:未指定型態的變數,一律自動宣告為Variant型態 05/01 13:00
fumizuki:Variant型態沒有初始值 05/01 13:02
fumizuki:IsEmpty只能拿來測試變數是否有值 05/01 13:02
fumizuki:而且只有Variant型態才能接受空值(Empty) 05/01 13:09
fumizuki:把字串指定為Empty後,會變成空字串 05/01 13:09
fumizuki:數值型態指定為Empty,會變成0 05/01 13:09
Thanks a lot ※ 編輯: gecer (111.255.233.239), 05/01/2014 20:05:08