# Syntax

## Overall syntax

> **DESIGN NOTE:**
>
> In Lit v1.0, the syntax is not so easy on eyes as I'd like to. There's limitations in my current knowledge about compilers, so I'll make some compromisses. However, in v2.0, I'll (hopefully) be able to get rid of them.
>
> Check [v2.0 docs](broken://pages/-MNKoKs7OBse5NgU3gWO) for the syntax I'm aiming for.

### Comprimisses of v1.0:

* All statements are ended with a `;`;
* All numbers are `Float`;
* Variable declaration require the `let` keyword;
* Function declaration require the `fn` keyword;
* Variables are actually mutable;

## Variables

In version 1.0, Lit will require the keyword `let` for declaring variables.

```ruby
let a = 1;
# => 1

let b = 2;
# => 2

let c = a + b;
# => 3

# You can redefine variables
a = "other value";
# => "other value"
```

Using keywords as variables will cause an error:

```ruby
let if = 123
# ERROR: SOMETHING BAD HAPPENED
```

### Allowed variable names

Variable names must begin with a letter (A-Z or a-z) or underscore. After that any letter, number or ? and ! is allowed.

```ruby
let camelCase = 1
let snake_case = 2
let PascalCase = 3
let ALL_CAPS = 4
let admin? = 5
let wow! = 6
let cool_right?! = 7
let _private = 8
let sOMETHING_elSe = "really?"
```

## Numbers

## Mathematical Operations and Elementary Functions

## Strings

There's no difference between single-quoted and double-quoted strings. They both can be interpolated:

```r
let n = 42;

"N is {n}" == 'N is {n}'
# => true
```

## Functions

## Control Flow

## Types?

## Data Structures (better name)

## Modules


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://matheusrich.gitbook.io/lit/getting-started/syntax.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
