SPECTRALANG_

// DOCS NAVIGATION

Padrões em match_

SOURCE: content/docs/reference/06-referencia-rapida.md06 Referência Rápida / 8. Padrões em match / Patterns in match

PadrãoSintaxeExemplo
Literal inteiro42when 42 then ...
Literal string"hello"when "ok" then ...
Literal booltrue / falsewhen true then ...
Wildcard_otherwise ...
Bindingnomewhen x then println(x)
Enum unitEnum::Varwhen Cor::Azul then ...
Enum tupleEnum::Var(a, b)when Ponto::Par(x, y) then ...
Enum structEnum::Var { campo }when Forma::Rect { w, h } then ...
Multi-padrãopat1 | pat2when 1 | 2 then ...
Guardwhen pat if cond then ...Não implementado ainda

Regra de exhaustividade / Exhaustiveness rule:
Todo match deve cobrir todos os casos possíveis. Use _ como wildcard.