doc: clean up array init docs
							parent
							
								
									5b69593766
								
							
						
					
					
						commit
						47313cbf27
					
				
							
								
								
									
										14
									
								
								doc/docs.md
								
								
								
								
							
							
						
						
									
										14
									
								
								doc/docs.md
								
								
								
								
							|  | @ -693,13 +693,6 @@ arrays there is a second initialization syntax: | |||
| mut a := []int{len: 10000, cap: 30000, init: 3} | ||||
| ``` | ||||
| 
 | ||||
| You can initialize the array by accessing the it variable as shown here: | ||||
| 
 | ||||
| ```v | ||||
| mut square := []int{len: 6, init: it * it} | ||||
| // square == [0, 1, 4, 9, 16, 25] | ||||
| ``` | ||||
| 
 | ||||
| This creates an array of 10000 `int` elements that are all initialized with `3`. Memory | ||||
| space is reserved for 30000 elements. The parameters `len`, `cap` and `init` are optional; | ||||
| `len` defaults to `0` and `init` to the default initialization of the element type (`0` | ||||
|  | @ -729,6 +722,13 @@ for i in 0 .. 1000 { | |||
| Note: The above code uses a [range `for`](#range-for) statement and a | ||||
| [push operator (`<<`)](#array-operations). | ||||
| 
 | ||||
| You can initialize the array by accessing the `it` variable as shown here: | ||||
| 
 | ||||
| ```v | ||||
| mut square := []int{len: 6, init: it * it} | ||||
| // square == [0, 1, 4, 9, 16, 25] | ||||
| ``` | ||||
| 
 | ||||
| #### Array Types | ||||
| 
 | ||||
| An array can be of these types: | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue