---
source: compiler-core/src/erlang/tests.rs
expression: "\npub fn main() {\n    let key = 10\n    let x = [#(10, 2), #(1, 2)]\n    case x {\n        [first, ..rest] if first.0 == key -> \"ok\"\n        _ -> \"ko\"\n    }\n}\n"
---
----- SOURCE CODE

pub fn main() {
    let key = 10
    let x = [#(10, 2), #(1, 2)]
    case x {
        [first, ..rest] if first.0 == key -> "ok"
        _ -> "ko"
    }
}


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

-file("project/test/my/mod.gleam", 2).
-spec main() -> binary().
main() ->
    Key = 10,
    X = [{10, 2}, {1, 2}],
    case X of
        [First | Rest] when erlang:element(1, First) =:= Key ->
            ~"ok";

        _ ->
            ~"ko"
    end.
