I've got the following Elixir code:defmodule Envvar do    def exists?(env) do :os.getenv(env) != false end    def get(env) do         if exists?(env) do            {env, :os.getenv(env)}        else             {env, nil}        end     endendTwo things:Am I using the ? correctly here?  I'm assuming that any predicate function should have the ? on the end of the name by convention.Is there a way to code the get function as a pattern match rather than a if/else?  I'm asking here because I'm guessing that a pattern match would be more idiomatic Elixir code.
Fetching environment variables  can I use pattern matching?
functional programming;error handling;elixir
Using the ? for a boolean predicate is fine. At least it is what I would do inRuby and Elixir.You won't be able to call exists?(env) in a guard clause so pattern matching does not win you much here.You are calling :os.getenv() twice unneccessarily. I'm not sure why you just want to convert 'false' to 'nil', here is a way:defmodule Envvar do  def get(env)    do_get(:os.getenv(env))  end  defp do_get(false)    {:env, nil}  end  defp do_get(result)    {:env,result}  endend