1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-11 09:14:39 +02:00

Merge pull request #3522 from kpeluso/master

[vyper/en] Update vyper.html.markdown
This commit is contained in:
Divay Prakash
2019-05-11 01:42:23 +05:30
committed by GitHub

View File

@@ -386,11 +386,16 @@ uint newLength = names.push("John"); # adding returns new length of the array
names.length; # get length names.length; # get length
names.length = 1; # lengths can be set (for dynamic arrays in storage only) names.length = 1; # lengths can be set (for dynamic arrays in storage only)
# multidimensional fixed array # Multidimensional Arrays
ls: (uint256[10])[3] # note the parentheses # At initialization, array dimensions must be hard-coded or constants
# Initialize a 10-column by 3-row, multidimensional fixed array
ls: (uint256[10])[3] # parentheses are optional
@public @public
def setToThree(): def setToThree():
self.ls[5][3] = 3 # multidimensional array access # Multidimensional Array Access and Write
# access indices are reversed
# set element in row 2 (3rd row) column 5 (6th column) to 3
self.ls[2][5] = 3
# Dictionaries (any simple type to any other type including structs) # Dictionaries (any simple type to any other type including structs)
theMap: map(uint256, bytes32) theMap: map(uint256, bytes32)