nick34992
6/30/2017 - 2:59 PM

Elixir: Module: case, atom, math.sqrt()

Elixir: Module: case, atom, math.sqrt()

defmodule Drop do

  def fall_velocity(planemo, distance) when distance >= 0 do
    case planemo do
     :earth -> :math.sqrt(2 * 9.8 * distance)
     :moon  -> :math.sqrt(2 * 1.6 * distance)
     :mars  -> :math.sqrt(2 * 3.71 * distance)
    end
  end
  
end