I guess you mean to remove the can_drink() function and rename legal() to can_drink() like the example below:
defmodulePersondodefcan_drink(age)whenis_nil(age),do:"You're not a Person"defcan_drink(age)whenage<18,do:"Nope!"defcan_drink(age)whenage<21,do:"Not in the US!"defcan_drink(age)whenage>=21,do:"YES!!!"endIO.putsPerson.can_drink(age)
You're right, but I thought that would've make more sense, more readable, and a little bit less confusing for people coming from other languages, the way I did it.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I guess you mean to remove the
can_drink()
function and renamelegal()
tocan_drink()
like the example below:You're right, but I thought that would've make more sense, more readable, and a little bit less confusing for people coming from other languages, the way I did it.