mirror of
https://github.com/teivah/100-go-mistakes.git
synced 2026-06-21 00:47:11 +08:00
29 lines
464 B
Go
29 lines
464 B
Go
package main
|
|
|
|
func handleOperations1(id string) {
|
|
operations := getOperations(id)
|
|
if operations != nil {
|
|
handle(operations)
|
|
}
|
|
}
|
|
|
|
func handleOperations2(id string) {
|
|
operations := getOperations(id)
|
|
if len(operations) != 0 {
|
|
handle(operations)
|
|
}
|
|
}
|
|
|
|
func getOperations(id string) []float32 {
|
|
operations := make([]float32, 0)
|
|
|
|
if id == "" {
|
|
return operations
|
|
}
|
|
|
|
// Add elements to operations
|
|
|
|
return operations
|
|
}
|
|
|
|
func handle(operations []float32) {}
|