IMO, the bar function is cleaner and more readable than the foo function.
How do you think?

    func foo() {
        if vs := f(); len(vs) == 0 {
        } else {
            for _, v := range vs {
            }
        }
        
        if vs := f(); len(vs) == 0 {
        } else {
            switch {
            case len(bs) == 0:
            case len(bs) == 1:
            default:
              }
        }
    }

    // vs.

    func bar() {
        if vs := f(); len(vs) == 0 {
        } else for _, v := range vs {
        }
        
        if vs := f(); len(vs) == 0 {
        } else switch {
        case len(vs) == 0:
        case len(vs) == 1:
        default:
        }
    }

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6b6d44d7-2ce5-4cd0-9347-88b350715088n%40googlegroups.com.

Reply via email to