[asterisk-users] Do While loop

Mojo with Horan & Company, LLC mojo at horanappraisals.com
Fri Nov 30 13:54:47 CST 2007


here's a do-while loop - the contents of the loop are executed BEFORE 
the condition is tested.
------------------------------------------------------------------
labelA:
  do some loopy things
  if (we need to loop again)
    goto labelA:
------------------------------------------------------------------

to contrast that, here's a while loop:
------------------------------------------------------------------
labelA:
  if (we need to do the loop at all)
  {
    do some loopy things
    goto labelA:
   }
------------------------------------------------------------------

Sorry it's in some pseudocode that doesn't really represent a language 
at all.  I can't produce asterisk's dialplan functions from memory yet! 
I'm sure that this will convert very simply though with minor work. "if" 
would become "GotoIf".

For the archives, the usage of asterisk's While construct is found at 
http://www.voip-info.org/wiki/index.php?page=Asterisk+cmd+While


Mojo


Mike wrote:
> Hi,
>  
> Is there a way to have a Do-While sort of loop, as opposed to a simple 
> While?
>  
> I have a condition that the loop depends on even for the first 
> iteration, as it often happens in life.
>  
> Regards,
>  
> Mike
> ------------------------------------------------------------------------
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list