---
sidebar_position: 2
title: Language Basics
---

import { SquiggleEditor } from "../../src/components/SquiggleEditor";

The squiggle language has a very simple syntax. The best way to get to understand
it is by simply looking at examples.

## Expressions

A distribution

<SquiggleEditor initialSquiggleString={`mixture(1 to 2, 3, [0.3, 0.7])`} />

A number

<SquiggleEditor initialSquiggleString="4.321e-3" />

Arrays

<SquiggleEditor
  initialSquiggleString={`[cauchy(1,1), 4, isNormalized(toPointSet(1 to 2))]`}
/>

Records

<SquiggleEditor initialSquiggleString="d1 = {dist: normal(0, 1), weight: 0.25}" />

## Statements

A statement assigns expressions to names. It looks like `<symbol> = <expression>`

<SquiggleEditor
  initialSquiggleString={`value_of_work = 10 to 70
5 + value_of_work / 75`}
/>

### Functions

We can define functions

<SquiggleEditor
  initialSquiggleString={`ozzie_estimate(t) = lognormal(1, t ^ 1.01)
nuño_estimate(t, m) = mixture(0.5 to 2, normal(m, t ^ 1.25))
ozzie_estimate(5) * nuño_estimate(5.01, 1)
`}
/>
