| 1 | <h2>Comments</h2> |
| 2 | <pre><code>// This is a comment |
| 3 | |
| 4 | /* This is a comment |
| 5 | on multiple lines */ |
| 6 | |
| 7 | /** |
| 8 | * This is a Javadoc style comment |
| 9 | * |
| 10 | * @hint This is an annotation |
| 11 | */ |
| 12 | </code></pre> |
| 13 | |
| 14 | <h2>Functions</h2> |
| 15 | <pre><code>public boolean function myFunc(required any arg) { |
| 16 | return true; |
| 17 | }</code></pre> |
| 18 | |
| 19 | <h2>Full example</h2> |
| 20 | <pre><code>component accessors="true" { |
| 21 | property type="string" name="prop1" default=""; |
| 22 | property string prop2; |
| 23 | function init(){ |
| 24 | this.prop3 = 12; |
| 25 | return this; |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * @hint Annotations supported |
| 30 | * @foo.hint |
| 31 | */ |
| 32 | public any function build( required foo, color="blue", boolean bar=true ){ |
| 33 | arguments.foo = { |
| 34 | 'name' : "something", |
| 35 | test = true |
| 36 | } |
| 37 | var foobar = function( required string baz, x=true, y=false ){ |
| 38 | return "bar!"; |
| 39 | }; |
| 40 | return foo; |
| 41 | } |
| 42 | } |
| 43 | </code></pre> |