在伪代码中,所有数组都有可声明的上限和下限。
在 VB.NET 中,所有数组都有可声明的上限,但下限始终为 0。
语言 |
一般用法 |
示例用法 |
伪代码 |
DECLARE <Identifier> : ARRAY[<Lower Bound>:<Upper Bound>] OF <Data Type>
|
DECLARE NameList : ARRAY[1:5] OF STRING
DECLARE YearlyRainfall : ARRAY[1900:2100] OF REAL
DECLARE AgeList : ARRAY[0:40] OF INTEGER
|
VB.NET |
Dim <Identifier>(<Upper Bound>) As <Data Type>
|
Dim NameList(4) As String
Dim YearlyRainfall(200) As Double
Dim AgeList(40) As Integer
|
Python |
|
NameList = []
YearlyRainfall = []
AgeList = []
|
语言 |
一般用法 |
示例用法 |
伪代码 |
DECLARE <Identifier> : ARRAY[<Lower Bound>:<Upper Bound>, <Lower Bound>:<Upper Bound>] OF <Data Type>
|
DECLARE GameArea : ARRAY[1:32, 0:16] OF STRING
DECLARE SudokuGrid : ARRAY[1:9, 1:9] OF INTEGER
DECLARE PopulationDensity : ARRAY[1:50, 20:50] OF REAL
|
VB.NET |
Dim <Identifier>(<Upper Bound>, <Upper Bound>) As <Data Type>
|
Dim GameArea(31, 16) As String
Dim SudokuGrid(8) As Integer
Dim PopulationDensity(49,30) As Double
|
Python |
<Identifier1> = []
<Identifier2> = []
<Identifier1>.append(<Identifier2>)
|
Game = []
GameArea = []
GameArea.append(Game)
SudokuX = []
SudokuGrid = []
SudokuGrid.append(SudokuX)
Longitude = []
PopulationDensity = []
PopulationDensity.append(Longitude)
|
语言 |
一般用法 |
示例用法 |
伪代码 |
<Identifier>[<Index>] ← <Value>
|
NameList[1] ← "Stephen"
YearlyRainfall[1985] ← 13.73
AgeList[39] ← 17
|
VB.NET |
<Identifier>(<Index>) = <Value>
|
NameList(0) = "Stephen"
YearlyRainfall(85) = 13.73
AgeList(38) = 17
|
Python |
<Identifier>.append(<Value>)
|
NameList.append("Stephen")
YearlyRainfall.append(13.73)
AgeList.append(17)
|
语言 |
一般用法 |
示例用法 |
伪代码 |
<Identifier>[<Index>,<Index>] ← <Value>
|
GameArea[16, 5] ← "Fire"
SudokuGrid[9, 3] ← 7
PopulationDensity[14, 32] ← 242.023
|
VB.NET |
<Identifier>(<Index>,<Index>) = <Value>
|
GameArea(15, 5) = "Fire"
SudokuGrid(8, 2) = 7
PopulationDensity(13, 12) = 242.023
|
Python |
<Identifier1> = []
<Identifier2> = []
<Identifier1>.append(<Identifier2>)
|
Game.append("Fire")
GameArea.append(Game)
SudokoX.append(7)
SudokuGrid.append(SudokuX)
Longitude.append(242.023)
PopulationDensity.append(Longitude)
|