home *** CD-ROM | disk | FTP | other *** search
/ Kompuutteri Kaikille K-CD 2002 #3 / K-CD_2002-03.iso / OpenOffice / f_0046 / sbasic.jar / text / sbasic / common / 03090303.xml < prev    next >
Extensible Markup Language  |  2001-09-07  |  4KB  |  61 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <html><head><title>On...GoSub Statement; On...GoTo Statement [Runtime]</title><meta name="filename" content="text/sbasic/common/03090303"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
  3.  
  4.         table.Tabelle1{
  5.                 }
  6.         span.Tabelle1A{
  7.                 width:1.499cm;}
  8.         span.Tabelle1B{
  9.                 width:16.498cm;}
  10.         tr.Tabelle11{
  11.                 }
  12.         td.Tabelle1A1{
  13.                 }
  14.         p.P1{
  15.                 }
  16.         span.T1{
  17.                 font-weight:bold;}
  18.         span.fr1{
  19.                 }
  20.         </style></head><body>
  21.   
  22.   
  23.   <help:to-be-embedded Eid="ongosub" xmlns:help="http://openoffice.org/2000/help">
  24.   <p class="Head1"><help:key-word value="On...GoSub" tag="kw66563_1"/><help:key-word value="On...GoTo" tag="kw66563_2"/><help:link Id="66563">On...GoSub Statement; On...GoTo Statement [Runtime]</help:link></p>
  25.   <p class="Paragraph">Branches to one of several specified lines in the program code, depending on the value of a numeric expression.</p>
  26.   </help:to-be-embedded>
  27.   <p class="Paragraph"><span class="T1">Syntax</span>:</p>
  28.   <p class="Paragraph">On N GoSub Label1[, Label2[, Label3[,...]]]</p>
  29.   <p class="Paragraph">On NumExpression GoTo Label1[, Label2[, Label3[,...]]]</p>
  30.   <p class="Paragraph"><span class="T1">Parameter</span>:</p>
  31.   <p class="Paragraph">NumExpression: Any numeric expression between 0 and 255 that determines which of the lines the program branches to. If NumExpression is 0, the statement will not be executed. If NumExpression is greater than 0, the program jumps to the respective label with a position number corresponding to the expression (1 = First label; 2 = Second label)</p>
  32.   <p class="Paragraph">Label: Target line according to <span class="T1">GoTo </span>or <span class="T1">GoSub</span> structure.</p>
  33.   <table><tr class="Tabelle11"><th class="Tabelle1A1" style="text-align:left;"><span class="Tabelle1A">
  34.       <p class="TextInTable"><draw:image draw:style-name="fr1" draw:name="HIND_1" text:anchor-type="paragraph" svg:width="0.847cm" svg:height="0.847cm" draw:z-index="0" xlink:href="65980" xlink:type="simple" xlink:show="embed" xlink:actuate="onRequest" draw:filter-name="GIF - Graphics Interchange" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:text="http://openoffice.org/2000/text" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"/>
  35.       </p>
  36.      </span></th><th class="Tabelle1A1" style="text-align:left;"><span class="Tabelle1B">
  37.       <p class="TextInTable">The <span class="T1">GoTo</span> or <span class="T1">GoSub </span>conventions are valid.</p>
  38.      </span></th></tr></table>
  39.   <p class="Paragraph"/>
  40.   <p class="Paragraph"><span class="T1">Example:</span></p>
  41.   <p class="PropText"/>
  42.   <p class="PropText">Sub ExampleOnGosub</p>
  43.   <p class="PropText">Dim iVar As Integer</p>
  44.   <p class="PropText">Dim sVar As String</p>
  45.   <p class="PropText">iVar = 2</p>
  46.   <p class="PropText">sVar =""</p>
  47.   <p class="PropText">On iVar GoSub Sub1, Sub2</p>
  48.   <p class="PropText">On iVar GoTo Line1, Line2</p>
  49.   <p class="PropText">Exit Sub</p>
  50.   <p class="PropText">Sub1:</p>
  51.   <p class="PropText">sVar =sVar & " From Sub 1 to" : Return</p>
  52.   <p class="PropText">Sub2:</p>
  53.   <p class="PropText">sVar =sVar & " From Sub 2 to" : Return</p>
  54.   <p class="PropText">Line1:</p>
  55.   <p class="PropText">sVar =sVar & " Label 1" : GoTo Ende</p>
  56.   <p class="PropText">Line2:</p>
  57.   <p class="PropText">sVar =sVar & " Label 2"</p>
  58.   <p class="PropText">Ende:</p>
  59.   <p class="PropText">MsgBox sVar,0,"On...Gosub"</p>
  60.   <p class="PropText">End Sub</p>
  61.  </body></html>