R: [Users] difference between return, break and exit.

Bogdan-Andrei Iancu bogdan at voice-system.ro
Mon Jun 26 20:10:23 CEST 2006


Hi,

just to be short - it's like in C:
    break - use it only in switch statement
    return  - terminates the current route execution and return in the 
above one
    exit - terminates the script execution disregarding how many levels 
down you are.

regards,
bogdan


D'Addelfio Davide wrote:

> Thanks for quick reply. Do you think in this case is bettr to use 
> return or break function?
>
>  
>
> if (method=="INVITE")  {
>
>             route(7);
>
>             return;
>
>       } else if (method=="ACK")  {
>
>             route(8);
>
>             return;
>
>       } else if (method=="CANCEL")  {
>
>             route(9);
>
>             return;
>
>       } else if (method=="BYE")  {
>
>             route(10);
>
>             return;
>
>       };
>
>  
>
>       if (loose_route()) {
>
>             xlog("L_INFO","Eseguo loose_route");
>
>             # mark routing logic in request
>
>             append_hf("P-hint: rr-enforced\r\n");
>
>             route(1);
>
>             return;
>
>       };
>
>  
>
>       if (uri==myself) {
>
>  
>
>             if (method=="REGISTER") {
>
>  
>
>                   # Uncomment this if you want to use digest 
> authentication
>
>                   #if (!www_authorize("138.132.167.240", "subscriber")) {
>
>                   #     www_challenge("138.132.167.240", "0");
>
>                   #     exit;
>
>                   #};
>
>  
>
>                   save("location");
>
>                   #exit;
>
>                   return;
>
>             };
>
>  
>
>       };
>
>  
>
> Thanks
>
> Davide
>
>  
>
> ------------------------------------------------------------------------
>
> *Da:* raviprakash sunkara [mailto:sunkara.raviprakash.feb14 at gmail.com]
> *Inviato:* lunedì 26 giugno 2006 14.21
> *A:* D'Addelfio Davide
> *Oggetto:* Re: [Users] difference between return, break and exit.
>
>  
>
> Hi Davide ,
>
>  openser 0.9 is having the break,,,  now in 1.0.1 and 1.1.0  is 
> using.... now..
> return is also used ...
> But the difference b/n the return and exit.. is
> In retuern the function is  + ve or - ve return type..
> where exit .... to gettinh out the condition function;
>
> bettter to use only exit  function...
>
> On 6/26/06, *D'Addelfio Davide* 
> <Davide.D'Addelfio at italtel-consultant.com 
> <mailto:Addelfio at italtel-consultant.com>> wrote:
>
> Hi to all,
>
>  
>
> i need to understand the difference in usage between return, break and 
> exit.
>
> Could someone help me, maybe with some example?
>
>  
>
> Thanks
>
> Davide   
>
>  
>
>
> _______________________________________________
> Users mailing list
> Users at openser.org <mailto:Users at openser.org>
> http://openser.org/cgi-bin/mailman/listinfo/users
>
>
>
>
> -- 
> Thanks and Regards with cheers
> Sunkara Ravi Prakash (Voip Developer)
> Hyperion Technology
> www.hyperion-tech.com <http://www.hyperion-tech.com>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Users mailing list
>Users at openser.org
>http://openser.org/cgi-bin/mailman/listinfo/users
>  
>





More information about the Users mailing list