# Iterate over the variants of an enum

Sometimes we need to go over all the variants of an enum and do something for each one of them.

{% embed include file="src/examples/enums/list-variants/Cargo.toml" %}

{% embed include file="src/examples/enums/list-variants/src/main.rs" %}

{% embed include file="src/examples/enums/list-variants/out.out" %}


