Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 

cHash data structure is very similar to an Hash Table object with key/value pairs.

 

It is also similar to cOptions object but more flexible: elements can be defined dynamically wthout the need to be defined first.

 

It can be used to store program parameters or objects elements.

 

There are many different ways to add key names to a cHash object

 

Key names can be specified in free form or using strings or string expressions.
Imagine to have a CHASH object like
Dim oHash as new CHASH

here below some examples on how to specify key name

 

Using .Add method
oHash.Add(ElementName: "Value")
 

dynamically specifying an unknown element name
oHash.ElementName = "Value"
 

dotted notation
oHash.ElementName.anysubname = "Value"
 

backslash notation
oHash.Element\Name\Sub\Name = "Value"
 

starting with a double quote string it will be interpreted as a string expression.
IMPORTANT: in this case a semi colon is needed to assign a value
oHash."ElementName" : "Value"
 

starting with $ interpolation function will be interpreted as a string expression.

IMPORTANT: in this case a semi colon is needed to assign a value
oHash.$("Element{left$(""name_xyzw"", 4)}") : "Value___$"

 

Example

 

cHash example showing how to add and use new elements on the fly to a cHash object

 

uses "console"
 
dim oHash as new cHash
 
'---Elements name can be added on the fly to oHash object just specifying an unknown element name
oHash.x = rnd(1, 1000)
oHash.y = rnd(1, oHash.y)
oHash.z = rnd(1, oHash.z)
'---Show oHash structure
printl oHash.ToString
 
'---Elements name can have \ or . as part of the name allowing names with complex meaning
oHash.x.y.x.point = "This is a complex element key name composed with ."
printl oHash.x.y.x.point
'---Show oHash structure
printl oHash.ToString

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software