---
title: "Everything is an expression"
image: "https://hem.run/social/hem.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://hem.run/llms.txt
> Use this file to discover all available pages before exploring further.

# Everything is an expression

`if` has no parentheses, requires braces, and yields a value:

```hem
let size = if n > 1000 { "large" } else { "small" }
```

Blocks after `=>` are statement blocks whose final expression is the return value, matching JavaScript syntax rules such as requiring parentheses to return an object literal directly: `(x) => ({ id: x })`.

An `if` **without** `else` in value position has type `?T` ("maybe absent"). This becomes the JSX conditional-rendering idiom in §12.

In statement position (a guard clause, or an imperative branch whose value you discard), `if` lowers to a plain TS `if` statement: diverging branches (`return`, `raise`, `throw`, `continue`, `break`) and an absent `else` are all legal, and no temporary or ternary is introduced. The canonical guard clause `if !ok { raise Invalid(…) }` reads exactly as it emits.

Source: https://hem.run/tour/everything-is-an-expression/index.mdx
