Hello world program of Go

Now we are going to move on to the Write code part.

We have completed our environment setup, and now it is time to sart working on our first very small program .

The first program that we are going to woking on is actually a "Hello world" type application.

In this section,we will figure out how to create a "Hello world" program of Go. In the next section,we will talk about each and every line of code in this program and do a really deep dive on Go how to work behind the scenes

If you prefer, you can skip this chapter.

We are going to put the whole program up on the screen

Now Let us satrt off by creating a new project folder.

You can find the File option at the top menu bar. and then click on the Open Folder option in the pop-up menu.

After you do that, a window should pop up, and then you should select a directory that you want to house your first program . And click on the "Select folder" button to open up the new folder.

Now you can locate the HelloWorld project in the pop-up left hand navigation panel.

The Navigation panel is what allows us to view all different files and folders that are inside of our working project.

Let us click on that area that says HelloWorld, You should see a set of buttons on the top right of the Navigation panel like this.

Then let us create a new file by clicking on the New File button,And call the file "main.go".

When we do that , you should have a code editor window open like this.

So Inside here is where we are going to put a hello world type program.

Now I will show how to write out the tiny program in this video. Let us go.

lesson 6

As that video says,we have completed writing out the whole hello world type program. We will discuss each and every line of code of the simple program in great detail. So see you next chapter

The original video and subtitles

Video: Hello World

subtitles :

Now that we are all done with our environment set up.

We are going to start working on our first very tiny, very little program.

Now the first program we are going to work on is essentially going to be a "Hello world" type app.

We are just going to connect console log out or log out some little piece of data.

And so I know this is a very boring program to start off with.

But trust me we are going to do a really deep dive on exactly how Go is working behind the scenes.

We are going to learn a lot about how we compile build projects all this kind of good stuff by just studing this tiny little program.

So even though it is going to be a very small program, we are going to learn a lot out of it.

So We are going to flip on over toward code editor.

In this section we are just going to wirte out a very simple program and then we will take a break,come back in the next video and we will start to do the deep dive on exactlly how it is working.

So I am going to start off by creating a new project folder to house the little program.

I am going to go up to file. I will click on Open and then I am going to make a new folder to house this new project.

It is going to click on the new folder down here and I am going to call the new folder

Now once I craete that new folder I should see it become selected and click on Open down here at the bottom to open up the newly created folder.

Now when I click on open I should see the left hand nav open up on the Explorer tab.

The Explorer tab is what allows me to view all different files and folders that are inside of my working project directory.

If you do not see the Explorer tab over here. You can always go to View and then click on Explorer right here.

Now inside of this hello world directory,

We are going to create a new file by clicking on the new file button right here.

So we are going to make a new file and call it main dot go

So inside here is where we are going to put a hello world type program.

Again we are going to jsut speed through the code right now.

We are going to throw it all up on the screen.

We are going to take a break and then come back and talk in great detail about each and every line that we are wirting out.

So let us just throw the code up here and then we will talk about what is going on in a moment.

So we will start off by saying package main.

Underneath that will say import ftm and make sure that "fmt" is inside of double quotes, not single quotes we want double quotes here.

And then underneath that will say "fun main",we will put a set of parentheses,

We will put a set of curly braces and inside of there "fmt.println" and make sure that print has a capital P and we will pass it another string of "Hi there" like so.

Now one thing I want to point out to you very important to make sure that you have double quotes both on the import statement right here and on the string that we are passing to the println function.

All right, so now we have put together a very simple and very basic program.

We are going to take a quick break and we are going to come back and we are going to figure out how to run the program and we are going to talk about each and every line code inside here in great great detial.

Quick break, we are going to come back and really dive into this code.

previous page: Cursor installation and GO configuration

next page:

相关推荐
KENYCHEN奉孝8 分钟前
Rust征服字节跳动:高并发服务器实战
服务器·开发语言·rust
挺菜的16 分钟前
【算法刷题记录(简单题)002】字符串字符匹配(java代码实现)
java·开发语言·算法
一只叫煤球的猫27 分钟前
真实事故复盘:Redis分布式锁居然失效了?公司十年老程序员踩的坑
java·redis·后端
妮妮喔妮1 小时前
【无标题】
开发语言·前端·javascript
大鸡腿同学1 小时前
身弱武修法:玄之又玄,奇妙之门
后端
fie88891 小时前
浅谈几种js设计模式
开发语言·javascript·设计模式
喝可乐的布偶猫1 小时前
Java类变量(静态变量)
java·开发语言·jvm
喝可乐的布偶猫2 小时前
韩顺平之第九章综合练习-----------房屋出租管理系统
java·开发语言·ide·eclipse
江山如画,佳人北望2 小时前
C#程序入门
开发语言·windows·c#
轻语呢喃3 小时前
JavaScript :字符串模板——优雅编程的基石
前端·javascript·后端