- Joined
- Jul 20, 2009
- Messages
- 835
Contributions from SirNikolas and Volchachka were there aswell.
I've decided to compare NULL with integers. Here are the results:
The code for testing:
What can it be?
I've decided to compare NULL with integers. Here are the results:
JASS:
// null<=0 - true
// null==0 - true
// null>=0 - true
// null>0 - false
// null<0 - false
// null!=0 - false
// null<=1 - true
// null==1 - false
// null>=1 - false
// null>1 - false
// null<1 - true
// null!=1 - true
The code for testing:
JASS:
function TestByteCodingBug takes nothing returns nothing
local string boolDesc = "false"
if null <= 0 then
set boolDesc = "true"
endif
call BJDebugMsg("null<=0 - "+boolDesc)
set boolDesc = "false"
if null == 0 then
set boolDesc = "true"
endif
call BJDebugMsg("null==0 - "+boolDesc)
set boolDesc = "false"
if null >= 0 then
set boolDesc = "true"
endif
call BJDebugMsg("null>=0 - "+boolDesc)
set boolDesc = "false"
if null > 0 then
set boolDesc = "true"
endif
call BJDebugMsg("null>0 - "+boolDesc)
set boolDesc = "false"
if null < 0 then
set boolDesc = "true"
endif
call BJDebugMsg("null<0 - "+boolDesc)
set boolDesc = "false"
if null != 0 then
set boolDesc = "true"
endif
call BJDebugMsg("null!=0 - "+boolDesc)
call BJDebugMsg("============================")
set boolDesc = "false"
if null <= 1 then
set boolDesc = "true"
endif
call BJDebugMsg("null<=1 - "+boolDesc)
set boolDesc = "false"
if null == 1 then
set boolDesc = "true"
endif
call BJDebugMsg("null==1 - "+boolDesc)
set boolDesc = "false"
if null >= 1 then
set boolDesc = "true"
endif
call BJDebugMsg("null>=1 - "+boolDesc)
set boolDesc = "false"
if null > 1 then
set boolDesc = "true"
endif
call BJDebugMsg("null>1 - "+boolDesc)
set boolDesc = "false"
if null < 1 then
set boolDesc = "true"
endif
call BJDebugMsg("null<1 - "+boolDesc)
set boolDesc = "false"
if null != 1 then
set boolDesc = "true"
endif
call BJDebugMsg("null!=1 - "+boolDesc)
endfunction
What can it be?