File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,57 @@ fun array2() {
124
124
}
125
125
```
126
126
127
+ * Example3*
128
+
129
+ ``` kotlin
130
+ fun array3 () {
131
+ val arr = IntArray (6 ) {it + 1 }
132
+ println (" Array 3" )
133
+ arr.forEach { println (it) }
134
+ }
135
+ ```
136
+
137
+ ** Multidemesinal Array**
138
+
139
+ * Example1*
140
+
141
+ ``` kotlin
142
+ fun array4_multidemesinal () {
143
+ val array = arrayOf(intArrayOf(1 , 2 ),
144
+ intArrayOf(3 , 4 ),
145
+ intArrayOf(5 , 6 , 7 ))
146
+
147
+ println (Arrays .deepToString(array))
148
+ }
149
+ ```
150
+
151
+ * Example2*
152
+
153
+ ``` kotlin
154
+ fun array5_multidemesinal () {
155
+ var num = 100
156
+
157
+ // Array Initialization
158
+ var twoDArray = Array (4 , {IntArray (3 )})
159
+ for (i in 0 .. twoDArray.size - 1 ) {
160
+ var rowArray = IntArray (3 )
161
+ for (j in 0 .. rowArray.size - 1 ) {
162
+ rowArray[j] = num++
163
+ }
164
+ twoDArray[i] = rowArray
165
+ }
166
+
167
+ // Array Value Printing
168
+ for (row in twoDArray) {
169
+ for (j in row) {
170
+ print (j)
171
+ print (" " )
172
+ }
173
+ println (" " )
174
+ }
175
+ }
176
+ ```
177
+
127
178
### Making function
128
179
129
180
``` kotlin
You can’t perform that action at this time.
0 commit comments