Quick actions

cmd+k|ctrl+k

Navigation

Languages

Elixir pattern matching

Snippet info

Language

Elixir

Visibility

public

Author

naren1012

Created

2016-04-30T04:18:36Z

Updated

2016-04-30T04:24:12Z

defmodule Main do

    def main() do
        http_map = %{"type" => "http", "http" => "http config"}
        tcp_map = %{"type" => "tcp", "tcp" => "tcp config"}
        handle(http_map)
        handle(tcp_map)
    end
    
    def handle(map=%{"type" => "http"}) do
        IO.puts "http handler: " <> map["http"]
    end
    
    def handle(map=%{"type" => "tcp"}) do
        IO.puts "tcp handler: " <> map["tcp"]
    end

end

Main.main
INFO