home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.comp.os.windows-xp      Actually wasn't too bad for a M$-OS      17,273 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 17,072 of 17,273   
   R.Wieser to All   
   Re: VBScript dictionary delete by index    
   06 Nov 25 16:09:12   
   
   XPost: alt.comp.lang.vbscript, alt.windows7.general   
   From: address@is.invalid   
      
   Mr. Man-wai Chang,   
      
   > If you can use array index to access oDict, you first count the number of   
   > items in oDict, then use a for loop from number of items back to 1.   
      
   That is what I'm curremtly doing :   
      
   for i=oDict.count-1 to 0 step -1   
      
   I still need to use   
      
   oDict.remove oDict.keys()(Index)   
      
   to remove the item, which does a double resolving (from index to key, and   
   than use the key to delete the key-item pair   
      
   If I can use a "for each" in reverse than I already have the key (and don't   
   need the index)   
      
      
      
   Arrrgggh...   
      
   I just realized I took it for granted that deleting a key-item pair while   
   inside a standard "for each" loop would cause an error/crash (looping beyond   
   the last item).   
      
   A quick test shows that that doesn't happen (and no entries are skipped).   
   iow, I saw a problem where none is present.   
      
   I can't even really say that the problem is solved, as it didn't exist in   
   the first place. :-( :-)   
      
   Regards,   
   Rudy Wieser   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca