18. Go - fmt Scan Inputs

 fmt.Scanln(&Variablename)

// waits for input and gives the variable the input

// does not consider whitespaces. only scans the first word that is before any whitespace


fmt.Scanf()

    var a string
    var b int64
    var c float32
    var d bool

    fmt.Scanf("%s %d %g %t", &a, &b, &c, &d)
    fmt.Println(a, b, c, d)

// lets us format the scan. each whitespace in the input will be set to each variable separated in the format.



Comments

Popular posts from this blog

2. FreeCodeCamp - Dynamic Programming - Learn to Solve Algorithmic Problems & Coding Challenges

20. Data Analytics - Analyze Data to Answer Questions - Week 1

3. Algorithms - Selection Sort