|
1240 | 1240 | | 5 | [What are the data types in Golang?](#what-are-the-data-types-in-golang) |
1241 | 1241 | | 6 | [Can you return multiple values from a function?](#can-you-return-multiple-values-from-a-function) |
1242 | 1242 | | 7 | [What is a GOPATH?](#what-is-a-gopath) |
1243 | | - |
| 1243 | +| 8 | [What are Goroutines?](#what-are-goroutines) |
| 1244 | +| 9 | [What is nil in Go?](#what-is-nil-in-go) |
| 1245 | +| 10 | [What is the difference between array and slice in Go?](#what-is-the-difference-between-array-and-slice-in-go) |
1244 | 1246 |
|
1245 | 1247 |
|
1246 | 1248 |
|
|
1328 | 1330 | The GOPATH environment variable specifies the location of your workspace. It defaults to a directory named go inside your home directory <br/> |
1329 | 1331 | The command go env GOPATH prints the effective current GOPATH; it prints the default location if the environment variable is unset. |
1330 | 1332 |
|
| 1333 | + **[ Back to Top ⬆ ](#table-of-contents---golang)** |
| 1334 | + |
| 1335 | +8. ### What are Goroutines? |
| 1336 | + |
| 1337 | + Goroutines are incredibly lightweight “threads” managed by the go runtime. They enable us to create asynchronous parallel programs that can execute some tasks far quicker than if they were written in a sequential manner. |
| 1338 | + |
| 1339 | + **[ Back to Top ⬆ ](#table-of-contents---golang)** |
| 1340 | + |
| 1341 | +9. ### What is nil in Go? |
| 1342 | + nil is a predeclared identifier in Go that represents zero values for pointers, interfaces, channels, maps, slices and function types. |
| 1343 | + |
| 1344 | + **[ Back to Top ⬆ ](#table-of-contents---golang)** |
| 1345 | + |
| 1346 | +10. ### What is the difference between array and slice in Go ? |
| 1347 | + |
| 1348 | + * **ARRAY** : An array is a fixed collection of data. The emphasis here is on fixed, because once you set the length of an array, it cannot be changed.<br/> |
| 1349 | + |
| 1350 | + ```go |
| 1351 | + arr := [4]int{3, 2, 5, 4} |
| 1352 | + ``` |
| 1353 | + * **SLICE** : Slices are much more flexible, powerful, and convenient than arrays. Unlike arrays, slices can be resized using the built-in append function . |
| 1354 | + |
| 1355 | + ```go |
| 1356 | + slicee := make([]Type, length, capacity) |
| 1357 | + ``` |
| 1358 | + |
1331 | 1359 | **[ Back to Top ⬆ ](#table-of-contents---golang)** |
0 commit comments