multiple case ... of ...

Bengt Kleberg bengt.kleberg@REDACTED
Tue Aug 10 14:27:35 CEST 2004


Dietmar Schäfer wrote:
> Hi !
> 
> Is there anybody out ther who can tell me how to do things 
> like this:

is it ok if i first ask you why you are doing what you are doing?
the first case ... of ... does not need the return values (ok and 
Reason) since they are not used. it would be sufficient to only have 
io:format() there.


bengt


> create_table() ->
>        case mnesia:create_table(fourd_mib_variables, [{snmp, [{key,
> string}]},  %%  o.k. ??
>                  {attributes, record_info(fields, fourd_mib_variables)},
>                  {disc_copies, [nodes()]}]) of
>          {atomic, ok}     -> io:format("table fourd_mib_variables could
> be created"),
>                              ok;
>          {aborted,Reason} -> io:format("creation of database failed
> reason.~n ~w",[Reason]),
>                              Reason
>        end,
> 
> 
>        case mnesia:create_table(command_table, [{snmp, [{key,
> string}]},  %% ist das so o.k. ??
>                  {attributes, record_info(fields, command_table)},
>                  {disc_copies, [nodes()]}]) of
>          {atomic, ok}     -> io:format("table command_table could be
> created"),
>                              ok;
>          {aborted,Reason} -> io:format("creation of database
> command_table failed reason.~n ~w",[Reason]),
>                              Reason
>        end.
> 



More information about the erlang-questions mailing list