Current section
Files
Jump to
Current section
Files
src/shapes.erl
-module(shapes).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([shape_info/1]).
-export_type([shape/0]).
-type shape() :: {rectangle, integer(), integer()} |
{circle, integer()} |
{square, float()}.
-file("/Users/bradleymehder/Developer/Frameworks/Gleam/playground/src/shapes.gleam", 14).
-spec shape_info(shape()) -> binary().
shape_info(Box) ->
case Box of
{rectangle, _, _} ->
<<"It's a rectangle."/utf8>>;
{circle, 42} ->
<<"It's a circle with a radius of 42."/utf8>>;
{circle, R} ->
<<<<"It's a circle with a radius of "/utf8,
(gleam@int:to_string(R))/binary>>/binary,
"."/utf8>>;
{square, Metre} ->
<<<<"It's a "/utf8, (gleam@float:to_string(Metre))/binary>>/binary,
" metre square."/utf8>>
end.