Restore
 
更改使用Data语句存储的值的下一个读取位置。

语法

Restore label

说明

将下一个数据读取指针设置为标签后第一个Data语句的第一个元素。标签必须包含在与当前执行代码相同的模块中。Restore更改DataRead的正常上下顺序。它允许在单个模块中重新读取一些Data或使用多组Data.

例子

'创建2个整数数组和2个字符串来保存数据。
Dim h(4) As Integer
Dim h2(4) As Integer
Dim hs As String
Dim hs2 As String
Dim read_data1 As Integer
Dim read_data2 As Integer

' Set the data read to the label 'dat2:'
Restore dat2

'设置循环5次(5个数字...检查数据)
For read_data1 = 0 To 4

  '读取整数。
  Read h(read_data1)

  '显示它。
  Print "集团1,号码"; read_data1;"="; h(read_data1)

Next

'间隔。
Print

'读一个字符串。
Read hs

'打印
Print  "Bloc 1 string =" + hs

'间隔。
Print
Print


' Set the data read to the label 'dat1:'
Restore dat1

'设置循环5次(5个数字...检查数据)
For read_data2 = 0 To 4

  '读取整数。
  Read h2(read_data2)

  '显示它。
  Print "Bloc 2,number"; read_data2;"="; h2(read_data2)

Next

'间隔。
Print

'读一个字符串。
Read hs2

'打印
Print  "Bloc 2 string =" + hs2

'等待按键。
Sleep

'退出程序。
End



'第一个数据块。
dat1:
Data 3, 234, 4354, 23433, 87643, "再见!"

'第二块数据。
dat2:
Data 546, 7894, 4589, 64657, 34554, "Hi!"








与QB差别

  • 没有

参考