🎓 Top 15 Udemy Courses (80-90% Discount): My Udemy Courses - Ramesh Fadatare — All my Udemy courses are real-time and project oriented courses.
▶️ Subscribe to My YouTube Channel (178K+ subscribers): Java Guides on YouTube
▶️ For AI, ChatGPT, Web, Tech, and Generative AI, subscribe to another channel: Ramesh Fadatare on YouTube
1. Introduction
Golang, commonly known as Go, is an open-source programming language that makes it easy to build simple, reliable, and efficient software. In this tutorial, we will write a very simple "Hello, World!" program in the Go programming language.
2. Program Overview
The primary objective is to create a Golang program that gracefully outputs the message "Hello, World!" to the console.
3. Code Program
// Declare the main package: the entry point for the application.
package main
// Import the fmt package for formatted I/O operations.
import "fmt"
// main function: the primary function that will be executed when the program runs.
func main() {
// Use the Println function from fmt package to print "Hello, World!" to the console.
fmt.Println("Hello, World!")
}
Output:
Hello, World!
4. Step By Step Explanation
1. Package Declaration:
Every Go program starts with a package declaration. Here, we've declared the main package, signaling that our program is a standalone executable.
// Declare the main package: the entry point for the application.
package main2. Import Statement:
By importing the fmt package, we gain access to various formatted I/O operations.
// Import the fmt package for formatted I/O operations.
import "fmt"3. Main Function:
The main function serves as our program's entry point. When the program is executed, it starts by running this function.
// main function: the primary function that will be executed when the program runs.
func main() {
// Use the Println function from fmt package to print "Hello, World!" to the console.
fmt.Println("Hello, World!")
}4. Print Function:
Inside our main function, we've called the fmt.Println() method. This function prints the string passed to it followed by a newline. In our case, it prints "Hello, World!" to the console.
// Use the Println function from fmt package to print "Hello, World!" to the console.
fmt.Println("Hello, World!")
My Top and Bestseller Udemy Courses. The sale is going on with a 70 - 80% discount. The discount coupon has been added to each course below:
Build REST APIs with Spring Boot 4, Spring Security 7, and JWT
[NEW] Learn Apache Maven with IntelliJ IDEA and Java 25
ChatGPT + Generative AI + Prompt Engineering for Beginners
Spring 7 and Spring Boot 4 for Beginners (Includes 8 Projects)
Available in Udemy for Business
Building Real-Time REST APIs with Spring Boot - Blog App
Available in Udemy for Business
Building Microservices with Spring Boot and Spring Cloud
Available in Udemy for Business
Java Full-Stack Developer Course with Spring Boot and React JS
Available in Udemy for Business
Build 5 Spring Boot Projects with Java: Line-by-Line Coding
Testing Spring Boot Application with JUnit and Mockito
Available in Udemy for Business
Spring Boot Thymeleaf Real-Time Web Application - Blog App
Available in Udemy for Business
Master Spring Data JPA with Hibernate
Available in Udemy for Business
Spring Boot + Apache Kafka Course - The Practical Guide
Available in Udemy for Business
Comments
Post a Comment
Leave Comment