# Scanner problem

**URL:** <https://forum.golangbridge.org/t/scanner-problem/20322>\
**Category:** Code Review\
**Created:** [August 26, 2020, 7:40pm UTC](https://forum.golangbridge.org/t/scanner-problem/20322 "2020-08-26T19:40:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![glwththat](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/glwththat/32/8334_2.png) [@glwththat](https://forum.golangbridge.org/u/glwththat)\
**Post date:** [August 26, 2020, 7:40pm UTC](https://forum.golangbridge.org/t/scanner-problem/20322/1 "2020-08-26T19:40:25Z")

</div>

![123](https://forum.golangbridge.org/uploads/default/original/2X/b/b525207597ad76e31eb6b68cb5b1f0570388a231.png)  
My program can not get a value of “floatvalue” from scan function.  
I am pretty sure that my code is coorect but for some reason it doesn’t execute right  
Am i doing smth wrong?  
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Visual Studio Code

Version: 1.48.1 (user setup)

Commit: 3dd905126b34dcd4de81fa624eb3a8cbe7485f13

Date: 2020-08-19T17:12:13.244Z

Electron: 7.3.2

Chrome: 78.0.3904.130

Node.js: 12.8.1

V8: 7.8.279.23-electron.0

OS: Windows\_NT x64 10.0.18362

Name: Go

Id: golang.go

Description: Rich Go language support for Visual Studio Code

Version: 0.16.

---

<div class="post-metadata">

**Author:** ![NobbZ](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/nobbz/32/3096_2.png) [@NobbZ](https://forum.golangbridge.org/u/NobbZ)\
**Post date:** [August 26, 2020, 7:56pm UTC](https://forum.golangbridge.org/t/scanner-problem/20322/2 "2020-08-26T19:56:53Z")

</div>

Have you checked the return value of `fmt.Scan`?

That would have been much more important than your version of chrome, electron or vscode…

Also perhaps post code as text in a code block rather than a picture of the code.

---

<div class="post-metadata">

**Author:** ![glwththat](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/glwththat/32/8334_2.png) [@glwththat](https://forum.golangbridge.org/u/glwththat)\
**Post date:** [August 26, 2020, 8:07pm UTC](https://forum.golangbridge.org/t/scanner-problem/20322/3 "2020-08-26T20:07:44Z")

</div>

sry im such a nweby, how do u do this?

---

<div class="post-metadata">

**Author:** ![NobbZ](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/nobbz/32/3096_2.png) [@NobbZ](https://forum.golangbridge.org/u/NobbZ)\
**Post date:** [August 26, 2020, 8:19pm UTC](https://forum.golangbridge.org/t/scanner-problem/20322/4 "2020-08-26T20:19:57Z")

</div>

How do you do what?

Checking return values?

Copy pasting code instead of putting screenshots?

Describing problems instead of just dropping a picture saying nothing?

---

<div class="post-metadata">

**Author:** ![glwththat](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/glwththat/32/8334_2.png) [@glwththat](https://forum.golangbridge.org/u/glwththat)\
**Post date:** [August 26, 2020, 8:23pm UTC](https://forum.golangbridge.org/t/scanner-problem/20322/5 "2020-08-26T20:23:23Z")

</div>

how do u check return values

---

<div class="post-metadata">

**Author:** ![NobbZ](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/nobbz/32/3096_2.png) [@NobbZ](https://forum.golangbridge.org/u/NobbZ)\
**Post date:** [August 26, 2020, 8:28pm UTC](https://forum.golangbridge.org/t/scanner-problem/20322/6 "2020-08-26T20:28:53Z")

</div>

`fmt.Scan` returns 2 values.

The first is the number of items it successfully parsed, the second is an error value.

If the first value is less than the number of arguments you passed to `fmt.Scan` then something went wrong and the other return value will be non-`nil`. In practice most just check the error value instead of the number of parsed arguments, but print/log the number for debugging purposes.

```go
_, err := fmt.Scan(&floatvalue)
if err != nil {
  panic(err)
}

```

---

<div class="post-metadata">

**Author:** ![glwththat](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/glwththat/32/8334_2.png) [@glwththat](https://forum.golangbridge.org/u/glwththat)\
**Post date:** [August 26, 2020, 8:30pm UTC](https://forum.golangbridge.org/t/scanner-problem/20322/7 "2020-08-26T20:30:40Z")

</div>

ty

---

<div class="post-metadata">

**Author:** ![NobbZ](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/nobbz/32/3096_2.png) [@NobbZ](https://forum.golangbridge.org/u/NobbZ)\
**Post date:** [August 26, 2020, 8:41pm UTC](https://forum.golangbridge.org/t/scanner-problem/20322/8 "2020-08-26T20:41:44Z")

</div>

So if you add checking the error, how does that change the behaviour/output of the program?

---

<div class="post-metadata">

**Author:** ![glwththat](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/glwththat/32/8334_2.png) [@glwththat](https://forum.golangbridge.org/u/glwththat)\
**Post date:** [August 26, 2020, 9:03pm UTC](https://forum.golangbridge.org/t/scanner-problem/20322/9 "2020-08-26T21:03:41Z")

</div>

It’s still the same, i allready found an error, so dont eorry about this and ty
