| 1 | <h2>Comments</h2> |
| 2 | <pre><code>-- A comment |
| 3 | </code></pre> |
| 4 | |
| 5 | <h2>Simple string and character</h2> |
| 6 | <pre><code>"A simple string with %"double quotes%"" |
| 7 | 'a' |
| 8 | </code></pre> |
| 9 | |
| 10 | <h2>Verbatim-strings</h2> |
| 11 | <pre><code>"[ |
| 12 | A aligned verbatim string |
| 13 | ]" |
| 14 | "{ |
| 15 | A non-aligned verbatim string |
| 16 | }" |
| 17 | </code></pre> |
| 18 | |
| 19 | <h2>Numbers</h2> |
| 20 | <pre><code>1_000 |
| 21 | 1_000. |
| 22 | 1_000.e+1_000 |
| 23 | 1_000.1_000e-1_000 |
| 24 | .1 |
| 25 | 0b1010_0001 |
| 26 | 0xAF_5B |
| 27 | 0c75_22 |
| 28 | </code></pre> |
| 29 | |
| 30 | <h2>Class names</h2> |
| 31 | <pre><code>deferred class |
| 32 | A [G] |
| 33 | |
| 34 | feature |
| 35 | items: G |
| 36 | deferred end |
| 37 | |
| 38 | end |
| 39 | </code></pre> |
| 40 | |
| 41 | <h2>Full example</h2> |
| 42 | <pre><code>note |
| 43 | description: "Represents a person." |
| 44 | |
| 45 | class |
| 46 | PERSON |
| 47 | |
| 48 | create |
| 49 | make, make_unknown |
| 50 | |
| 51 | feature {NONE} -- Creation |
| 52 | |
| 53 | make (a_name: like name) |
| 54 | -- Create a person with `a_name' as `name'. |
| 55 | do |
| 56 | name := a_name |
| 57 | ensure |
| 58 | name = a_name |
| 59 | end |
| 60 | |
| 61 | make_unknown |
| 62 | do ensure |
| 63 | name = Void |
| 64 | end |
| 65 | |
| 66 | feature -- Access |
| 67 | |
| 68 | name: detachable STRING |
| 69 | -- Full name or Void if unknown. |
| 70 | |
| 71 | end |
| 72 | </code></pre> |