doc: 2d array example (#6058)
							parent
							
								
									df332f85b7
								
							
						
					
					
						commit
						8d9f38f670
					
				
							
								
								
									
										18
									
								
								doc/docs.md
								
								
								
								
							
							
						
						
									
										18
									
								
								doc/docs.md
								
								
								
								
							|  | @ -524,6 +524,24 @@ println(upper) // ['HELLO', 'WORLD'] | |||
| 
 | ||||
| `it` is a builtin variable which refers to element currently being processed in filter/map methods. | ||||
| 
 | ||||
| #### Multidimensional Arrays | ||||
| 
 | ||||
| Arrays can have more than one dimension. | ||||
| 
 | ||||
| 2d array example: | ||||
| ```v | ||||
| mut a := [][]int{len:2, init: []int{len:3}} | ||||
| a[0][1] = 2 | ||||
| println(a) // [[0, 2, 0], [0, 0, 0]] | ||||
| ``` | ||||
| 
 | ||||
| 3d array example: | ||||
| ```v | ||||
| mut a := [][][]int{len:2, init: [][]int{len:3, init: []int{len:2}}} | ||||
| a[0][1][1] = 2 | ||||
| println(a) // [[[0, 0], [0, 2], [0, 0]], [[0, 0], [0, 0], [0, 0]]] | ||||
| ``` | ||||
| 
 | ||||
| ### Maps | ||||
| 
 | ||||
| ```v | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue