elixir-lang / elixir-lang.github.com

Website for Elixir
elixir-lang.org
355 stars 824 forks source link

Fix Erlang version of sum/2 function in the crash course article #1754

Closed 7006 closed 8 months ago

7006 commented 8 months ago

I've copied Erlang version of function sum/2 from https://elixir-lang.org/crash-course.html#identifying-functions, compiled and run it in the Erlang shell

The "a" in Erlang is actually a list(yep it's weird) so we fall into the 2nd clause of sum/2 function

So we should use binary syntax in order to fall into the 3rd clause of function

Screenshot 2024-03-04 at 00 16 28 Screenshot 2024-03-04 at 00 17 29
whatyouhide commented 8 months ago

Thanks @7006! 💟