# Enumeration Variant expressions

> **Syntax**\
> _EnumerationVariantExpression_ :\
>       _EnumExprStruct_\
>    | _EnumExprTuple_\
>    | _EnumExprFieldless_
>
> _EnumExprStruct_ :\
>    [_PathInExpression_] `{` _EnumExprFields_? `}`
>
> _EnumExprFields_ :\
>       _EnumExprField_ (`,` _EnumExprField_)\* `,`?
>
> _EnumExprField_ :\
>       [IDENTIFIER]\
>    | ([IDENTIFIER] | [TUPLE_INDEX]) `:` [_Expression_]
>
> _EnumExprTuple_ :\
>    [_PathInExpression_] `(`\
>       ( [_Expression_] (`,` [_Expression_])\* `,`? )?\
>    `)`
>
> _EnumExprFieldless_ : [_PathInExpression_]

Enumeration variants can be constructed similarly to [structs], using a path to an enum
variant instead of to a struct:

```rust
# enum Message {
#     Quit,
#     WriteString(String),
#     Move { x: i32, y: i32 },
# }
let q = Message::Quit;
let w = Message::WriteString("Some string".to_string());
let m = Message::Move { x: 50, y: 200 };
```

Enum variant expressions have the same syntax, behavior, and restrictions as [struct
expressions][structs], except they do not support base update with the `..` syntax.

[IDENTIFIER]: ../identifiers.md
[TUPLE_INDEX]: ../tokens.md#tuple-index
[_Expression_]: ../expressions.md
[_PathInExpression_]: ../paths.md#paths-in-expressions
[structs]: struct-expr.md
