---
source: compiler-core/src/erlang/tests.rs
expression: "pub fn tail(list) {\n  case list {\n    [x, ..] -> x\n    _ -> 0\n  }\n}"
---
----- SOURCE CODE
pub fn tail(list) {
  case list {
    [x, ..] -> x
    _ -> 0
  }
}

----- COMPILED ERLANG
-module(my@mod).
-compile([no_auto_import, nowarn_ignored, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-export([tail/1]).

-file("project/test/my/mod.gleam", 1).
-spec tail(list(integer())) -> integer().
tail(List) ->
    case List of
        [X | _] ->
            X;

        _ ->
            0
    end.
