Restore.htm 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>Restore label</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. label = any valid and exisiting label
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. When using Data statements to store large blocks of constants for use with the Read command, it is necessary to denote the start of the Data with a .Label. The Restore command moves the 'pointer' to the first Data statement's value following the designated label. You MUST use the Restore label command prior to using the Read command. This method allows you to store groups of Data statements non-sequentially. Its different (if you are used to other BASIC languages) but you will find it most flexible. See the example and other commands related to Data command.
  21. <br>
  22. <br>
  23. See also: <a class=small href=Read.htm>Read</a>, <a class=small href=Data.htm>Data</a>.
  24. </td>
  25. </tr>
  26. </table>
  27. <h1><a href=../2d_examples/Restore.bb>Example</a></h1>
  28. <table>
  29. <tr>
  30. <td>
  31. ; Sample of read/restore/data/label commands <br />
  32. <br />
  33. ; Let's put the data pointer to the second data set <br />
  34. Restore seconddata <br />
  35. <br />
  36. ; Let's print them all to the screen <br />
  37. For t = 1 To 10 <br />
  38. Read num ; Get the next data value in the data stack <br />
  39. Print num <br />
  40. Next <br />
  41. <br />
  42. ; Now for the first set of data <br />
  43. Restore firstdata <br />
  44. <br />
  45. ; Let's print them all to the screen <br />
  46. For t = 1 To 10 <br />
  47. Read num ; Get the next data value in the data stack <br />
  48. Print num <br />
  49. Next <br />
  50. <br />
  51. ; this is the first set of data <br />
  52. .firstdata <br />
  53. Data 1,2,3,4,5,6,7,8,9,10 <br />
  54. <br />
  55. ; this is the second set of data <br />
  56. .seconddata <br />
  57. Data 11,12,13,14,15,16,17,18,19,20
  58. </td>
  59. </tr>
  60. </table>
  61. <br>
  62. <a target=_top href=../index.htm>Index</a><br>
  63. <br>
  64. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=Restore&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  65. </html>