[SR-Dev] if condition syntax

Andrei Pelinescu-Onciul andrei at iptel.org
Wed Apr 22 10:25:20 CEST 2009


On Apr 22, 2009 at 10:54, Juha Heinanen <jh at tutpro.com> wrote:
> according to wiki page, sip-router has improved while and switch syntax,
> but how about if condition syntax?
> 
> can i write, for example,
> 
> if (script_function() == 2) ...

No.

> 
> of do i still need to do
> 
> script_function();
> if ($retcode == 2) ...

Yes.

> 
> by the way, i didn't quite understand the case example (first case
> expression):
> 
> switch($var(x)){
>         case / "^[abc]" :
> 
> what is the meaning of /?

What's following is a regular expression and not a normal string
(without it it's interpreted as string).


Andrei



More information about the sr-dev mailing list