Elixir Course Online | Prograils - Software Development Company
Modules and named functions exercises
Exercises
Create
Greeter
module withhello_world
function which prints "Hello world". Load it intoIEx
with different approaches to compile the file and check if it works.Extend
Integer
module with azero?
function which returns true if given integer is zero.Create
circle_surface_area
function inside ofMath
module, which calculates the surface area of a circle. Use@pi
attribute.Create
factorial
function which calculates the factorial of the given number. It should use recursion and pattern matching to bind different arguments.Create
fibonacci
function which for given n number will print n-th fibonacci number.Create nested module
School.Class.Teacher
and give it an aliasProfessor
.Create a
contain_digits?
function insideChecker
module which takes a chars list as an argument and checks if it contains digits. Checking itself should be performed inside of a private function and result should be printed as a string message. Tip: checkString.graphemes
.