Golang (programming language) .... Debugging, Googling Solutions To Coding - - - PART ONE

preview_player
Показать описание
In this video we try again another "Hello World PLUS ONE" (using Golang Programming Language) ... We learn how to do Debugging, and how we may use Google To Find Solutions To Coding Situations, Receiving User Input, and Outputting information, Using Variables, Data types, etc.

Useful links to read through regarding today's Coding tasks in this lecture ...

The code used in today's lecture:

// You can edit this code!
// Click here and start typing.
package main

import (
"fmt"
"math/rand"
"strconv"
"os"
)

func main() {
fmt.Println("please guess a number between 1 and 6 : ")
var theGuess string
fmt.Scanln(&theGuess)
//theGuess = strconv.Atoi(theGuess)
i, err := strconv.Atoi(theGuess)
if err != nil {
// handle error
fmt.Println(err)
os.Exit(2)
}

fmt.Print("the winning number is:")
var theWinner int = rand.Intn(7)
fmt.Print(theWinner)

if i == theWinner {
fmt.Println("you won!")
} else {
fmt.Println("sorry you lost")
}


}

++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++

Please checkout and join my FREE Code Way 2EZ google classroom right here:
Рекомендации по теме