Skip to content

Literal notation

Hannes Hirzel edited this page Apr 28, 2014 · 3 revisions

note from the ML, 22th April 2014

Example

{
    #{'x' -> 0. 'y' -> 50}.
    #{'x' -> 50. 'y'-> 50}.
    #{'x' -> 50. 'y' -> 0}.
    #{'x' -> 0. 'y'-> 0}
}

(important note: do not put . before the closing }s) gives

 an Array (a HashedCollection ('x' -> 0 , 'y' -> 50) a HashedCollection ('x' -> 50 , 'y' -> 50) a HashedCollection ('x' -> 50 , 'y' -> 0) a HashedCollection ('x' -> 0 , 'y' -> 0)) 

Or

#{'fill' -> '#bada55'.  'stroke' -> '#000'. 'strokeWidth' -> 5} 

gives

a HashedCollection ('fill' -> '#bada55' , 'stroke' -> '#000' , 'strokeWidth' -> 5)    

An Amber HashedCollection is a JavaScript object and thus may be directly used in a call to a JavaScript function. Call JavaScript constructors with arguments

Clone this wiki locally