* Sagar Byahatti <sagarbyaha...@gmail.com> [240220 08:22]:
>  package main
> 
> import "fmt"
> 
> func main() {
> 
>     var projectName = "APY"
>     var sub = 50
> 
>     fmt.Println("Welcome to", projectName, " the number of subscriber is ", 
> sub)
>     fmt.Println("Enter your name: ")
>     var userName string
> 
>     fmt.Scan(&userName)
> 
>     fmt.Printf("%v, your PRAN Number is", userName)
> 
> }

fmt.Scan is probably not what you want, though if I run your program and
type a single word (no spaces) and then a newline, I get the result that
I think you are expecting.

You probably want to look at the bufio package, and specifically the
Reader.ReadString method.  Something like (untested)

    var input = bufio.NewReader(os.Stdin)
    var userName, err = input.ReadString('\n')

...Marvin

-- 
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/ZdTKkauBRy02Hh7w%40basil.wdw.

Reply via email to