This chapter showcases Cone's features using code examples. Additional examples may be found in the Cone Playground.

Literal values: Each comment specifies the type of the values.

```null          // Null
true, false   // Bool
123, -3i8     // i32, i8
3.4d, 0.3E-2  // f64. f32
'\n'          // u32 character
"Χαίρετε"     // String

// Text literals enclosed within '"""' may span multiple lines
"""A line.\n\tIndented line\n
\t\"Another line\u00BF\""""
```

Names

```# Variables start with letter or _
balance, π, temp2, toReturn
_temp_      // Leading underscore designates 'private'

Point       // types are capitalized, by convention
```

Assignment:

```a = 3.4         // a now holds the Integer 3.4
a = b = c       // a and b now have the value found in c
a = (b = c) + 1 // assignments may be embedded in expressions
a,b = b,a       // parallel assignment (this swaps their values)
a += 1          // operator assignment, incrementing value of a
```
```// Return nth term of fibonacci sequence
fn fib(mut n i32) i32				// parms may be marked as mutable
mut val = 1						// mutable local variable declaration
mut inc = 0
while --n > 0
val, inc = val+inc, val		// parallel assignment
val								// implicit return

// Calculate sum of first five terms of fibonacci sequence
fn sumfib5() i32
mut sum = 0
each i in 1 <= 5
sum += fib(i)
```

struct

```// Define a struct type named Point
struct Point
// Public, floating-point fields
x f32
y f32

// Calculate distance of point from origin
fn len() f32			// `self Point` is inferred
(x*x + y*y).sqrt    // Infers x as `self.x`

// Subtract two points, overriding `-` infix operator
fn `-`(pt2) Point
Point[pt2.x - x, pt2.y - y]

// Use Point to return calculated 5
fn pythagoras() f32
imm pt1 = Point[3., 0.]     // struct constructor
mut pt2 = pt1				// Copy by default
pt2 -= Point[3., -4.]		// -= uses `-` operator implicitly
(pt1 - pt2).len
```
```struct Counter
_count u32	// Private field, because of initial underscore

// Initializer needed due to private field
fn init(new self &)
_count = 0u

// Allow struct calling, overriding call operator `()`
fn `()`() u32
++_count

// Reset counter, with 0 as default start
fn reset(start = 0u)
_count = start

fn counting()
mut counter = Counter()
imm one = counter()
imm two = counter()
counter.reset
imm anotherone = counter()
```