How to declare two variables (vars) with different values in one line with Go

1 Answer

0 votes
package main

import (    
    "fmt"
    "reflect"
)

func main() {
    var x, y int32 = 234, 87

    fmt.Println(x)
    fmt.Println(y)
    
    fmt.Println(reflect.TypeOf(x))   
    fmt.Println(reflect.TypeOf(y))  
}




/*
run:

234
87
int32
int32

*/

 



answered Sep 20, 2020 by avibootz

Related questions

1 answer 234 views
1 answer 243 views
1 answer 136 views
2 answers 234 views
...