ReScript HomeReScript Home
DocsPlaygroundBlogCommunityPackages
  • Playground
  • Blog
  • Community
  • Packages
  • X
  • Bluesky
  • GitHub
  • Forum
Language ManualAPISyntax LookupReact

Syntax Lookup

Enter some language construct you want to know more about.
This is the or-pattern syntax in switch.

Use | inside a pattern to match multiple cases with one branch.

Example

ReScriptJS Output
let n = 1

let label = switch n {
| 0 | 1 => "small"
| _ => "other"
}

References

  • Pattern Matching

© 2026 The ReScript Project

About
  • Community
  • ReScript Association
Find us on