Many developers will use the “if-else” statement for single line functions, For example,def role(admin) if admin == “admin” return true else return false end end
Why we don’t start using a ternary here?def role(admin)
admin == "admin" ? true : false end
Another way to use the conditions as the return object.def role(admin) admin == "admin" end
Leave a Reply