You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1681,6 +1681,27 @@
1681
1681
1682
1682
**[ Back to Top ⬆ ](#table-of-contents---golang)**
1683
1683
1684
+
28. ### If capacity is not defined in slice, what would the capacity be?
1685
+
It would be set by default to length of the slice
1686
+
1687
+
**[ Back to Top ⬆ ](#table-of-contents---golang)**
1688
+
1689
+
29. ### What is the easiest way to check if a slice is empty?
1690
+
You can use the length (len(slice)) property to find if the slice is empty
1691
+
1692
+
```go
1693
+
if(len(slice_data)==0){
1694
+
fmt.Println("Empty slice")
1695
+
}
1696
+
```
1697
+
**[ Back to Top ⬆ ](#table-of-contents---golang)**
1698
+
1699
+
30. ### What is an advantage of Go evaluating implicit types at compile time?
1700
+
Types can be implicitly inferred from expressions and don’t need to be explicitly specified.The special handling of interfaces and the implicit typing makes Go feel very lightweight and dynamic.
1701
+
1702
+
**[ Back to Top ⬆ ](#table-of-contents---golang)**
| 26 | [Do you need to convert the type of a variable of interface{} type passed in a function as an argument?](#do-you-need-to-convert-the-type-of-a-variable-of-interface{}-type-passed-in-a-function-as-an-argument)
4
-
| 27 | [Why are goroutines light-weight?](#why-are-goroutines-light-weight)
5
-
| 28 | [If capacity is not defined in slice, what would the capacity be?](#if-capacity-is-not-defined-in-slice,-what-would-the-capacity-be)
6
-
| 29 | [What is the easiest way to check if a slice is empty?](#what-is-the-easiest-way-to-check-if-a-slice-is-empty)
3
+
7
4
| 30 | [What is an advantage of Go evaluating implicit types at compile time?](#what-is-an-advantage-of-go-evaluating-implicit-types-at-compile-time)
0 commit comments