Groups | Search | Server Info | Login | Register
Groups > alt.comp.lang.vbscript > #29
| From | "R.Wieser" <address@is.invalid> |
|---|---|
| Newsgroups | alt.comp.lang.vbscript, alt.comp.os.windows-xp, alt.windows7.general |
| Subject | Re: VBScript dictionary delete by index ? solved |
| Date | 2025-11-08 09:07 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <10emtp7$2eep5$1@dont-email.me> (permalink) |
| References | <10eho89$10spk$1@dont-email.me> <10ei9rv$15pcl$1@dont-email.me> <10eiacg$15l4r$6@toylet.eternal-september.org> <10eidms$16s68$1@dont-email.me> <10emept$2av65$1@toylet.eternal-september.org> |
Cross-posted to 3 groups.
Mr. Man-wai Chang, >> If I can use a "for each" in reverse than I already have the key (and >> don't >> need the index) > > You can first sort oDict in reverse order, but that's quite silly. :) Yes, and it would not solve anything. :-| (the contents are not the problem) > > 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). > > That surely could be a problem for linked list, not array index. I'm not at all sure about the first, as the "next" pointer (for the iteration) doesn't need to be replaced (assuming that its retrieved and stored somewhere as part of advancing to the current item). The problem with a "for i=0 to dict.count-1" loop is that it both will skip the item after the one thats being removed, and it will not adjust the "upto here" part of the for loop to the new size of the array. Looping backwards makes both of those problems disappear. ... and thats what my head was - unneeded - stuck on. :-\ Regards, Rudy Wieser
Back to alt.comp.lang.vbscript | Previous | Next — Previous in thread | Next in thread | Find similar
VBScript dictionary delete by index ? "R.Wieser" <address@is.invalid> - 2025-11-06 10:03 +0100
Re: VBScript dictionary delete by index ? "R.Wieser" <address@is.invalid> - 2025-11-06 15:03 +0100
Re: VBScript dictionary delete by index ? "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2025-11-06 22:12 +0800
Re: VBScript dictionary delete by index ? solved "R.Wieser" <address@is.invalid> - 2025-11-06 16:09 +0100
Re: VBScript dictionary delete by index ? solved "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2025-11-08 11:52 +0800
Re: VBScript dictionary delete by index ? solved "R.Wieser" <address@is.invalid> - 2025-11-08 09:07 +0100
Re: VBScript dictionary delete by index ? solved "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2025-11-08 22:55 +0800
Re: VBScript dictionary delete by index ? solved "R.Wieser" <address@is.invalid> - 2025-11-08 16:49 +0100
Re: VBScript dictionary delete by index ? C-Sharp User <csharp@invalid.invalid> - 2025-11-06 22:40 +0000
Re: VBScript dictionary delete by index ? "R.Wieser" <address@is.invalid> - 2025-11-07 09:15 +0100
csiph-web