It is currently Fri Nov 21, 2008 9:19 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Some basic help with dictionaries
PostPosted: Mon Aug 14, 2006 10:59 pm 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1207
Location: Southern Central USA
I am ashamed to admit that I have never worked with dictionaries (the software kind ofcourse), atleast that I know of.

Can I have an example of how one builds a dictionary and how the elements in the dictionary are addressed/accessed?

Thanks.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 15, 2006 3:47 am 
Offline
POL Developer
User avatar

Joined: Wed Jan 25, 2006 2:30 am
Posts: 428
Location: San Diego, California
Think of it like an array, but the index can be anything.

http://poldoc.fem.tu-ilmenau.de/pol096/ ... Dictionary


Example:
Code:
var my_var := dictionary;
my_var["kiko"] := "Learning Dicts.";
my_var[mobile_ref] := my_var["Kiko"];


You can check the existance of something with
if ( dictionary.Exists(key) ) or if ( dictionary[key] )

Associative arrays is another way to describe them.

_________________
-Austin


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 15, 2006 2:05 pm 
Offline
Certified POL Expert
User avatar

Joined: Thu Feb 02, 2006 1:41 pm
Posts: 1207
Location: Southern Central USA
Thanks Austin.

I have been familiar with various structured data types having programmed in everything from TRSDOS BASIC to Pascal and Delphi but for some reason (perhaps age? Nah! not that!) I just have trouble grasping dictionaries.

_________________
Sincerely,
Yukiko

I know you think you understand what you thought I said but what you heard is not exactly what I meant.

Titus 2:13


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl