<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>method on Golang</title><link>https://golang.k5kc.com/categories/method/</link><description>Recent content in method on Golang</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sun, 16 Aug 2020 00:10:00 +0530</lastBuildDate><atom:link href="https://golang.k5kc.com/categories/method/index.xml" rel="self" type="application/rss+xml"/><item><title>Functional literals</title><link>https://golang.k5kc.com/2020/08/16/functional-literals/</link><pubDate>Sun, 16 Aug 2020 00:10:00 +0530</pubDate><guid>https://golang.k5kc.com/2020/08/16/functional-literals/</guid><description>A functional literal just represents an anonymous function. You can assign functional literal to a variable:
package main import ( &amp;#34;fmt&amp;#34; ) func main() { f := func() { fmt.Println(&amp;#34;Hello, भारत！&amp;#34;) } f() } Or invoke functional literal directly (Please notice the () at the end of functional literal):
package main import ( &amp;#34;fmt&amp;#34; ) func main() { func() { fmt.Println(&amp;#34;Hello, भारत！&amp;#34;) }() } The above 2 programs both output &amp;ldquo;Hello, भारत！&amp;rdquo;.</description></item><item><title>Go - init function</title><link>https://golang.k5kc.com/2020/08/16/init-function/</link><pubDate>Sun, 16 Aug 2020 00:10:00 +0530</pubDate><guid>https://golang.k5kc.com/2020/08/16/init-function/</guid><description>There is a init() function, as the name suggests, it will do some initialization work, such as initializing variables which may not be expressed easily, or calibrating program state. A file can contain one or more init() functions, as shown here:
package main import &amp;#34;fmt&amp;#34; var global int = 0 func init() { global++ fmt.Println(&amp;#34;In first Init(), global is: &amp;#34;, global) } func init() { global++ fmt.Println(&amp;#34;In Second Init(), global is: &amp;#34;, global) } func main() { fmt.</description></item></channel></rss>