Skip to content

Instantly share code, notes, and snippets.

@scsibug
Created February 9, 2012 01:28
Show Gist options
  • Save scsibug/1776258 to your computer and use it in GitHub Desktop.
Save scsibug/1776258 to your computer and use it in GitHub Desktop.
Error Printer
-module(error_printer).
-export([error_check/1]).
% Write a function that uses matching to selectively print "success"
% or "error: message" given input of the form {error, Message} or
% success.
error_check({error, M}) ->
io:format("~p~n",[M]);
error_check(success) ->
io:format("~p~n",["success"]).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment