Wiki

Changes between Version 4 and Version 5 of Literals

Show
Ignore:
Timestamp:
01/15/11 12:24:08 (14 years ago)
Author:
hopscc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Literals

    v4 v5  
    55 
    66== List Literals == 
    7 List contents comma separated, collection  [] delimited. 
     7Dynamically sized heterogenous content data structures. 
     8 
     9List contents are comma separated, collection  is [] delimited. 
    810 
    911Empty list is [] 
     
    2022}}} 
    2123 
    22 == Map/Dictionary Literals == 
    23 Key and value colon separated, each entry comma separated, collection {} delimited. 
     24== !Map/Dictionary Literals == 
     25Also known as associative arrays or Dictionaries (Dicts).[[BR]] 
     26 
     27Key and value is colon separated, each entry comma separated, collection is {} delimited. 
    2428 
    2529empty map is {:}. 
     
    3842 
    3943== Set Literals == 
    40 Values comma separated, collection {} delimited. 
     44Unordered hashed collection of unique items optimized for membership testing and set operations. 
     45 
     46Values are comma separated, collection is {} delimited. 
    4147 
    4248Empty set is {}. 
     
    5460}}} 
    5561 
     62 
     63== Array Literals == 
     64Statically sized homogenous content data structure. 
     65 
     66Values are comma separated, collection is [] delimited with an '@' prefix. 
     67 
     68Empty array is @[] 
     69 
     70e.g  
     71{{{ 
     72#!cobra 
     73names = @[ 'mike', 'gary', 'pat', 'bruce', 'paul'] # String[] or Array<of String> 
     74heads = @[3,1,1,1,1] # int[] or Array <of int> 
     75heads[4] = 3 
     76 
     77}}} 
     78 
     79Lists are probably easier to use and more flexible but for some purposes arrays have better performance. 
    5680 
    5781== Numeric Literals == 
     
    96120}}} 
    97121 
     122== String Literals == 
     123 
     124See [wiki:Strings] 
     125 
     126 
     127 
    98128[wiki:LanguageTopics Back to LanguageTopics]