OR construction in erlang ?

Vladimir Sekissov svg@REDACTED
Tue Apr 12 21:29:45 CEST 2005


Good day,

olivier.sambourg> ok = test_function(Args) or throw(error_in_test_function).

ok = test_function(Args) orelse throw(error_in_test_function).

Best Regards,
Vladimir Sekissov

olivier.sambourg> Hi everyone
olivier.sambourg> 
olivier.sambourg> Is there an equivalent to the PHP "or" construction ? I'd like to be 
olivier.sambourg> able to throw errors when a match fails, i.e. :
olivier.sambourg> 
olivier.sambourg> ok = test_function(Args) or throw(error_in_test_function).
olivier.sambourg> 
olivier.sambourg> I know I can achieve the same with a catch and case syntax but nesting 
olivier.sambourg> several tests gets ugly (or increases the number of functions in a 
olivier.sambourg> module).
olivier.sambourg> 
olivier.sambourg> Thanks :)
olivier.sambourg> 
olivier.sambourg> --
olivier.sambourg> Olivier
olivier.sambourg> 
olivier.sambourg> 



More information about the erlang-questions mailing list