Good Morning!,
today i want to make a tutorials about how to calculate your age on mars with Go!, Its very simple and easy but is funny.
Okey let go!
1. make Folder and Go file
i make folder to save this tutorials, and make a go file with name main.go
2. Then, we start coding!
In file main.go , create "package main" in the top main.go
3. step 3, make the contents the code
After create "Package main", next we make a import "fmt" under package main.
make a function main and variabel with name "age" and with type int is for interger, after make variabel we make a output for to tell the user to enter a number
4. Make input for user
Now we make a input field for user with fmt.Scaln , which receives the address of the age variable using a pointer
5. Make a formula for calculating age on mars
Lest go for make a formula for calculating age on mars, the formula is like this
after make this formula, next we to print of result from formula, this way
the parts print the result of the formula, we take the data from mars and then parse it
5. final result
we run the code with "go run main.go"
if you want to see my code, this is my code in my repository in Github
End
and that's my tutorial on how to calculate age on mars, thank you and don't forget to like and share
Top comments (0)