I have the following code:
reader := bufio.NewReader(os.Stdin)
fmt.Print("room: width x length: ")
inStr, _ := reader.ReadString('
')
result := strings.Split(inStr, "x")
string1, _ := strconv.ParseFloat(result[0], 64)
string2, _ := strconv.ParseFloat(result[1], 64)
fmt.Print(string2)
At the last print statement, if i print string1
it returns the right value, but if i try to print string2
it returns 0, no matter what value i input to the console.
Does anyone know why this is happening? Thanks!