How to handle nested case

hokan.stenholm@REDACTED hokan.stenholm@REDACTED
Sun Sep 19 20:36:03 CEST 2021


Another option is to simply turn it into a sequential series of function calls.

This avoids the nesting though it's more verbose than the try or with variants.

get_nas_from_conf() ->

case get_radius_host() of

{ok, Server} -> step2(Server)

E -> E



step2(Server) ->

case get_radius_port() of

{ok, Port} -> step3(Server, Port)

E -> E



step3(Server, Port) ->

case get_radius_secret() of

{ok, Secret} -> {Server, Port, Secret};

E -> E


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the erlang-questions mailing list