realbasic-nug
[Top] [All Lists]

Dictionary lookup confuses me

To: REALbasic-NUG NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Dictionary lookup confuses me
From: Gerard Hammond <realbasic at macsos dot com dot au>
Date: Wed, 30 Apr 2008 13:56:37 +1000
Authentication-results: mx.google.com; spf=pass (google.com: domain of realbasic-nug-bounces at lists dot realsoftware dot com designates 66.116.103.65 as permitted sender) smtp dot mail=realbasic-nug-bounces at lists dot realsoftware dot com
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
Hi All,

I need to look into a dictionary just to see if a key exists.

But the key seems to only exist if the value is an integer. 0 and  
doubles for the value cause the key to not be found by .lookup

This sounds like a bug to me.
What am I doing wrong?


   dim n as new Dictionary
   n.Value("thiskey") = 1 ' changing this to 0 leads to Nope, setting  
this to 1 leads to Yep, setting this to 1.2 leads to Nope - That is  
just weird...

   if n.Lookup("thiskey", -1) Then
     MsgBox "yep this key exists"
   else
     MsgBox "nope this key does not exists"
   end if


Cheers.

--

Dr Gerard Hammond
Garvan Institute of Medical Research



Cheers.

--

Dr Gerard Hammond
http://www.macsos.com.au

The Macintosh may only have 10% of the market, but it is clearly the  
top 10%.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>