Append an element to the slice:
1 2 nums := []int{1, 2, 3} nums = append(nums, 4) Append multiple elements to the slice:
1 2 nums := []int{1, 2} nums = append(nums, 3, 4) Append slice to another slice:
break and continue statements can be use with label in Go, similar to goto statement. It is optional. Scope of labels are limited to the function and does not conflict with variable name, as it live in separate space. break and continue with label is only used in for, switch and select statements.
Switch cases in go can use fallthrough keyword to fall into next case without checking it’s condition if the current case has fallthrough statement at the end.
For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 i := 142 switch { case i > 100: fmt.