From 550d856ea9e527f8d0f11c19ac7afb235a1a0609 Mon Sep 17 00:00:00 2001 From: David Sally Date: Tue, 11 Feb 2020 21:34:44 -0800 Subject: [PATCH] =?UTF-8?q?Say=20hello=20in=20elixir=20=F0=9F=92=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .tool-versions | 3 +++ README.md | 3 ++- elixir/index.exs | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .tool-versions create mode 100644 elixir/index.exs diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..ed7c34b --- /dev/null +++ b/.tool-versions @@ -0,0 +1,3 @@ +rust 1.41.0 +elixir 1.10 +erlang 22.2 diff --git a/README.md b/README.md index 1a87585..a8378c2 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ The rules are: - [ ] c++ - [x] css - [ ] coffeescript -- [ ] elixir +- [x] elixir +- [ ] erlang - [ ] java - [x] javascript - [x] python diff --git a/elixir/index.exs b/elixir/index.exs new file mode 100644 index 0000000..8dba57d --- /dev/null +++ b/elixir/index.exs @@ -0,0 +1,16 @@ +defmodule Main do + # with no input provided + def say_hello() do + name = "world" + IO.puts("hello, " <> name <> "!") + end + + # with input provided + def say_hello(name) do + IO.puts("hello, " <> name <> "!") + end +end + +# To run: elixirc ./elixir/index.exs +IO.puts(Main.say_hello("world")) +IO.puts(Main.say_hello())