Android Question [solved]question on "Null"

Maodge

Member
Licensed User
pls look at the following code
B4X:
dim map1 as map
dim s as string
dim o as object

    map1.Initialize
    map1.Put("4","d")
    map1.Put("1","a")
    map1.Put("101","a")

s = map1.get(1) ' s = null
o = map1.Get(1) 'o = null

    If s<> Null Then
        Log("s is not null")
    Else
        Log("s is null")
    End If

    If o<> Null Then
        Log("o is not null")
    Else
        Log("o is null")
    End If

run the program, the log shows"
s is not null
o is null

so why first if s<> Null then... prgram judge (s<> Null) = True
and the second if o<> Null Then... prgram judge (o<> Null) = False ?
What leads to such result?
Thanks
 
Last edited:

Maodge

Member
Licensed User
"1" is not the same as 1.

The first key is a string and the second is an int.
thanks.maybe i did not decribe question clear.
i want know why
first if s<> Null then... prgram judge (s<> Null) = True
and the second if o<> Null Then... prgram judge (o<> Null) = False
the different between s and o -- s is string type and o is object type.
Did type can effect the result of logic equals?
 
Upvote 0
Top