[Go] How to write or call a function


I will write down various functions in Go language so as not to forget them.

How to define a function

func function name() {
//Write the process you want to summarize

How to call a function

Function name()

Pass a value to a function

Function name(value)

Receive and use arguments


funk main() {
//Passing cat as an argument to the variable animal

funk ask(animal string) {
  fmt.Printf("%s/n", animal)

Recommended Posts

[Go] How to write or call a function
How to call a function
[Python] How to call a c function from python (ctypes)
How to write a Python class
How to make a recursive function
Qiita (1) How to write a code name
How to create a function object from a string
How to write a ShellScript Bash for statement
[Introduction to Python] How to write a character string with the format function
How to Mock a Public function in Pytest
How to write a ShellScript bash case statement
How to achieve something like a list of void * (or variant) in Go?
How to write a GUI using the maya command
[Go] How to create a custom error for Sentry
How to write a list / dictionary type of Python3
[Python] How to write a docstring that conforms to PEP8
How to deploy a Go application to an ECS instance
XPath Basics (2) -How to write XPath
Write a kernel density function
How to hack a terminal
How to define Go variables
[Go] How to use "... (3 periods)"
How to use the __call__ method in a Python class
How to print characters as a table with Python's print function
How to write a test for processing that uses BigQuery
I'll never forget how to write a shell script, don't forget! !!
To write a test in Go, first design the interface
How to write a metaclass that supports both python2 and python3
How to call Python or Julia from Ruby (experimental implementation)
How to make a Japanese-English translation
Call a Python function from p5.js.
How to use the zip function
How to put a symbolic link
How to write soberly in pandas
Flask reuse How to write html
How to make a slack bot
Write standard output to a file
How to create a virtual bridge
Python-dynamically call a function from a string
How to create a Dockerfile (basic)
[Blender] How to make a Blender plugin
How to delete a Docker container
How to write Docker base image
How to write Django1.9 environment-independent wsgi.py
How to make a crawler --Basic
How to use python zip function
Notes on how to write requirements.txt
How to install Go on Ubuntu
How to create a config file
How to call PyTorch in Julia
[Road to Python Intermediate] Call a class instance like a function with __call__
How to make a string into an array or an array into a string in Python
[Introduction to Python] How to split a character string with the split function
How to write code to access python dashDB on Bluemix or local
[Python 3.8 ~] How to define a recursive function smartly with a lambda expression
Is R's do.call () a classical higher-order function? Learn how to use
Difference in execution speed depending on how to write Cython function
How to write a docstring to create a named tuple document with sphinx
Create a function to get the contents of the database in Go
How to create a clone from Github
How to call a POST request that supports Japanese (Shift-JIS) with requests