User Input (fmt.Scan, bufio, os.Args, strconv) - Go Tutorial for Beginners #5

13views
00
5:43
T
Taught by Celeste AI - AI Coding Coach
View on YouTube
Description
Learn how to read user input in Go! In this lesson, you will learn: โœ… Basic input with fmt.Scan and fmt.Scanln โœ… Reading full lines with bufio.Reader and bufio.Scanner โœ… Accessing command-line arguments with os.Args โœ… Parsing strings to numbers with strconv (Atoi, ParseFloat, ParseBool) ๐Ÿ• Timestamps: 0:00 - Introduction 0:24 - Basic Input with fmt.Scan 1:20 - Line Input with bufio 2:17 - Command Line Arguments 3:11 - Parsing with strconv 4:17 - Recap 4:47 - End ๐Ÿ’ป Code from this lesson: // Basic input with fmt.Scan var name string fmt.Print("Enter your name: ") fmt.Scanln(&name) // Reading lines with bufio reader := bufio.NewReader(os.Stdin) line, _ := reader.ReadString('\n') // Command-line arguments fmt.Println(os.Args[0]) // program name fmt.Println(os.Args[1]) // first argument ๐Ÿ”— Previous: Lesson 4 - Numbers & Math ๐Ÿ”— Next: Lesson 6 - Control Flow: if/else
Back to tutorials

Duration

5:43

Published

January 27, 2026

Added to Codegiz

March 15, 2026

๐Ÿ“– Read the articleOpen in YouTube