home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / programs / comms_networking / zonk / rawdocs / cwhil < prev    next >
Encoding:
Text File  |  1999-02-12  |  1.7 KB  |  40 lines

  1. $zonkpage 1.07
  2.  
  3. title: While... endwhile
  4.  
  5. text:{<sh>Syntax:</sh>
  6.  
  7.  
  8. <lit><zonk while <var><var>expression</var></var>><var>anything</var><zonk endwhile></lit> 
  9.  
  10. <sh>Description</sh>
  11.  
  12. Tests an <var>expression</var> as defined in <ref genc>general concepts</r> and if <i>the value is not NULL</i> processes all the html (including Zonk commands) upto the endwhile. When the endwhile is reached, if the <var>expression</var> was a simple variable name then an implicit <ref cread>zonk read</r> is performed on this variable, if this provides another value then the condition is still true and the loop is done again. You cannot use static variables as a while control variable.
  13.  
  14. If the <var>expression</var> is the bracketed form then it is the template writers responsibility to do something inside the loop which might change the value of the <var>expression</var> and so cause the loop to exit when the condition retested. <b>!Beware the infinite loop!</b> 
  15.  
  16. Also note that a NULL value for a variable is <i>NOT</i> the same as an empty string. You only get a NULL value if the variable is not defined or you have read all of the values of a dynamic variable.
  17.  
  18. Whiles may be nested an indefinite number of times.
  19.  
  20. <sh>Examples</sh>
  21.  
  22. <lit><zonk while town><zonk tagvalue town><p><zonk endwhile></lit>
  23. using the following definitions of town
  24. <lit>town: London
  25. town: Manchester
  26. town: Birmingham</lit>
  27. would give
  28. <lit>London<p>Manchester<p>Birmingham<p></lit> 
  29.  
  30. If you use:
  31.  
  32. <lit><zonk maketag c (%d) 1>
  33. <zonk while (^c .lt 4)><zonk tagvalue ^c>:
  34. <zonk maketag c (%d) (^c +1)>
  35. <zonk endwhile></lit>
  36.  
  37. then you would get:
  38. <lit>1:
  39. 2:
  40. 3:</lit>