Re: How to handle nested case

[email protected]
Newsgroups gmane.comp.lang.erlang.general
Message-ID <[email protected]>
	



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

end.

 

step2(Server) ->

case get_radius_port() of

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

E -> E

end.

 

step3(Server, Port) ->

case get_radius_secret() of

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

E -> E

end.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.