{rating_check_passed, rating_check_msg} =
LobbyPolicy.check_rating_to_play(user.id, state)
cond do
not rating_check_passed ->
Is there a way to move the calling of the function check_rating_to_play inside the cond itself?
I tried this:
cond do
LobbyPolicy.check_rating_to_play(user.id, state) == {false, rating_check_msg} ->
#I need to do something with rating_check_msg here
but that doesn’t work. The benefit of calling the function within the cond is that if I had some other checks within the cond that satisfy first the function doesn’t get called.
Looks like code that can be further broken apart. If you show some more code we’ll help you but as @emadb said, case can be applied here. Or different variants of pattern-matching function heads.