{"id":9761,"date":"2022-08-02T12:54:10","date_gmt":"2022-08-02T12:54:10","guid":{"rendered":"https:\/\/prwatech.in\/blog\/?p=9761"},"modified":"2024-04-15T08:37:06","modified_gmt":"2024-04-15T08:37:06","slug":"introduction-2","status":"publish","type":"post","link":"https:\/\/prwatech.in\/blog\/go-lang\/introduction-2\/","title":{"rendered":"Introduction :"},"content":{"rendered":"<h2><span data-sheets-root=\"1\" data-sheets-value=\"{&quot;1&quot;:2,&quot;2&quot;:&quot;INTRODUCTION Definition &amp; Usage Examples&quot;}\" data-sheets-userformat=\"{&quot;2&quot;:513,&quot;3&quot;:{&quot;1&quot;:0},&quot;12&quot;:0}\">INTRODUCTION Definition &amp; Usage Examples<\/span><\/h2>\n<p>An introduction to a programming topic typically provides foundational information about the concept, its usage, and its relevance in software development. In this context, the introduction to &#8220;Definition &amp; Usage Examples&#8221; would focus on clarifying what these terms mean in the realm of programming and how they contribute to understanding and applying programming concepts.<\/p>\n<p>&#8220;Definition&#8221; refers to the explicit explanation or specification of a concept or term within the context of programming. It involves clearly defining the purpose, behavior, and characteristics of a programming construct, method, or pattern.<\/p>\n<p>&#8220;Usage Examples&#8221; refer to practical demonstrations or instances showcasing how a programming concept is applied in real-world scenarios. These examples help illustrate the concept&#8217;s functionality, demonstrate its benefits, and provide insights into how it can be leveraged effectively in programming tasks.<\/p>\n<ol>\n<li>Go Language is a cross-platform, open-source <a href=\"https:\/\/go.dev\/\">programming<\/a> <a href=\"https:\/\/prwatech.in\/blog\/go-lang\/installation-of-go-windows\/\">language<\/a> use for general purposes.<\/li>\n<li>Go is fast, statically typed, compiled language that feels like a dynamic typed, interpreted language.<\/li>\n<li>Go syntax is similar to C++.<\/li>\n<\/ol>\n<h2><strong><u>Uses of Go <\/u><\/strong><\/h2>\n<ol>\n<li>Web Development.<\/li>\n<li>Developing network-based programs.<\/li>\n<li>Developing cross-platform enterprise application<\/li>\n<li>Cloud-native development.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><strong>Ex : Hello World Program<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">\/\/ First.go\r\npackage main\r\nimport \"fmt\"\r\nfunc main() {\r\n    fmt.Println(\"Hello Prwatech.\")\r\n}\r\n<\/pre>\n<p>Output :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">PS C:\\GO_Language\\String&gt; go run First.go\r\nHello Prwatech\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong><u>Go Syntax:<\/u><\/strong><\/p>\n<ol>\n<li>Package declaration<\/li>\n<li>Import package<\/li>\n<li>Statements and expressions<\/li>\n<\/ol>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">package main         \t\t\t\t\/\/Package declaration\r\nimport \"fmt\"\t\t\t\t\t\/\/Import Package \r\nfunc main() {\r\n    fmt.Println(\"This is  Prwatech Institute of Data Science\")\t\/\/Statement and expressions\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>\n<h2><strong><strong>Strings in Golang:<\/strong><\/strong><\/h2>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ol>\n<li>In this program we have to write a string in a sentence then print the sentence and data type.<\/li>\n<\/ol>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">\/\/str.go\r\npackage main\r\nimport (\r\n    \"fmt\"\r\n    \"reflect\"\r\n)\r\nfunc main() {\r\n    var s string = \"Hello, this is the first Go language program.\"\r\n    fmt.Println(s)\r\n    fmt.Println(reflect.TypeOf(s))\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Output :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">PS C:\\GO_Language\\String&gt; go run str.go\r\nHello, this is the first Go language program\r\nstring\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>2) Go program to illustrate how to check the given string start with the specified prefix<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">\/\/str2.go\r\npackage main\r\n\r\nimport (\r\n    \"fmt\"\r\n    \"strings\"\r\n)\r\n\r\nfunc main() {\r\n    s := \"Hii Prwatech...\"\r\n    fmt.Println(s)\r\n    fmt.Println(strings.HasSuffix(s, \"BI\"))\r\n}\r\n<\/pre>\n<p>Output :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">PS C:\\GO_Language\\String&gt; go run str2.go\r\nHii Prwatech...\r\nFalse\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>3) Go program to illustrate how to repeat a string to a specific number of times<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">\/\/str3.go\r\npackage main\r\n\r\nimport (\r\n    \"fmt\"\r\n    \"strings\"\r\n)\r\n\r\nfunc main() {\r\n    var str = \"Prwatech \"\r\n    fmt.Println(\"\\n \", strings.Repeat(str, 5))\r\n}\r\n<\/pre>\n<p>Output :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">PS C:\\GO_Language\\String&gt; go run str3.go\r\n\r\n  Prwatech Prwatech Prwatech Prwatech Prwatech\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>4) Golang program to demonstrate the example of fmt.Scan() function.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">package main\r\n\r\nimport \r\n    \"fmt\"\r\nfunc main() {\r\n    var no int\r\n    \/\/ Input a number\r\n    fmt.Print(\"Input a number: \")\r\n    n, err := fmt.Scan(&amp;no)\r\n\r\n    \/\/ Print the value, n and err\r\n    fmt.Println(\"number: \", no)\r\n    fmt.Println(n, \" Item(s) scanned.\")\r\n    fmt.Println(\"Error: \", err)\r\n}\r\n<\/pre>\n<p>Output :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">PS C:\\GO_Language\\String&gt; go run scan.go\r\nInput a number: 10\r\nnumber:  10\r\n1  Item(s) scanned.\r\nError:  &lt;nil&gt;\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>5) <\/strong>Golang program to demonstrate the example of fmt.Scan() function. Input two values &amp; write their Sentence.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"golang\">package main\r\nimport \"fmt\"\r\n\r\nfunc main() {\r\n    var name string\r\n    var age int\r\n\r\n    fmt.Println(\"Enter the name :\")\r\n    fmt.Scan(&amp;name)\r\n    fmt.Println(\"Enter the age  :\")\r\n    fmt.Scan(&amp;age)\r\n    fmt.Printf(\"My name is  %s I am  %d years old.\", name, age)\r\n\r\n}\r\n<\/pre>\n<p>Output :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">PS C:\\GO_Language\\String&gt; go run scan2.go\r\nEnter the name :Sandeep\r\nEnter the age  :23\r\nMy name is  Sandeep I am  23 years old.\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>INTRODUCTION Definition &amp; Usage Examples An introduction to a programming topic typically provides foundational information about the concept, its usage, and its relevance in software development. In this context, the introduction to &#8220;Definition &amp; Usage Examples&#8221; would focus on clarifying what these terms mean in the realm of programming and how they contribute to understanding [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[666,1707],"tags":[667,812,808],"class_list":["post-9761","post","type-post","status-publish","format-standard","hentry","category-go-lang","category-golang-modules","tag-go-lang","tag-go-lang-tutorial","tag-go-language"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>INTRODUCTION Definition &amp; Usage Examples - Prwatech<\/title>\n<meta name=\"description\" content=\"Master Introduction to Nested Structures in Golang - Definition, Usage, and Examples - Dive deep with our expert instructors.\" \/>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"INTRODUCTION Definition &amp; Usage Examples - Prwatech\" \/>\n<meta property=\"og:description\" content=\"Master Introduction to Nested Structures in Golang - Definition, Usage, and Examples - Dive deep with our expert instructors.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prwatech.in\/blog\/go-lang\/introduction-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Prwatech\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prwatech.in\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-02T12:54:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-15T08:37:06+00:00\" \/>\n<meta name=\"author\" content=\"Prwatech\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:site\" content=\"@Eduprwatech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prwatech\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prwatech.in\/blog\/go-lang\/introduction-2\/\",\"url\":\"https:\/\/prwatech.in\/blog\/go-lang\/introduction-2\/\",\"name\":\"INTRODUCTION Definition & Usage Examples - Prwatech\",\"isPartOf\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#website\"},\"datePublished\":\"2022-08-02T12:54:10+00:00\",\"dateModified\":\"2024-04-15T08:37:06+00:00\",\"author\":{\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\"},\"description\":\"Master Introduction to Nested Structures in Golang - Definition, Usage, and Examples - Dive deep with our expert instructors.\",\"breadcrumb\":{\"@id\":\"https:\/\/prwatech.in\/blog\/go-lang\/introduction-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prwatech.in\/blog\/go-lang\/introduction-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prwatech.in\/blog\/go-lang\/introduction-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/prwatech.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Introduction :\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/prwatech.in\/blog\/#website\",\"url\":\"https:\/\/prwatech.in\/blog\/\",\"name\":\"Prwatech\",\"description\":\"Share Ideas, Start Something Good.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/prwatech.in\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3\",\"name\":\"Prwatech\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g\",\"caption\":\"Prwatech\"},\"url\":\"https:\/\/prwatech.in\/blog\/author\/prwatech123\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"INTRODUCTION Definition & Usage Examples - Prwatech","description":"Master Introduction to Nested Structures in Golang - Definition, Usage, and Examples - Dive deep with our expert instructors.","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"INTRODUCTION Definition & Usage Examples - Prwatech","og_description":"Master Introduction to Nested Structures in Golang - Definition, Usage, and Examples - Dive deep with our expert instructors.","og_url":"https:\/\/prwatech.in\/blog\/go-lang\/introduction-2\/","og_site_name":"Prwatech","article_publisher":"https:\/\/www.facebook.com\/prwatech.in\/","article_published_time":"2022-08-02T12:54:10+00:00","article_modified_time":"2024-04-15T08:37:06+00:00","author":"Prwatech","twitter_card":"summary_large_image","twitter_creator":"@Eduprwatech","twitter_site":"@Eduprwatech","twitter_misc":{"Written by":"Prwatech","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/prwatech.in\/blog\/go-lang\/introduction-2\/","url":"https:\/\/prwatech.in\/blog\/go-lang\/introduction-2\/","name":"INTRODUCTION Definition & Usage Examples - Prwatech","isPartOf":{"@id":"https:\/\/prwatech.in\/blog\/#website"},"datePublished":"2022-08-02T12:54:10+00:00","dateModified":"2024-04-15T08:37:06+00:00","author":{"@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3"},"description":"Master Introduction to Nested Structures in Golang - Definition, Usage, and Examples - Dive deep with our expert instructors.","breadcrumb":{"@id":"https:\/\/prwatech.in\/blog\/go-lang\/introduction-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prwatech.in\/blog\/go-lang\/introduction-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/prwatech.in\/blog\/go-lang\/introduction-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/prwatech.in\/blog\/"},{"@type":"ListItem","position":2,"name":"Introduction :"}]},{"@type":"WebSite","@id":"https:\/\/prwatech.in\/blog\/#website","url":"https:\/\/prwatech.in\/blog\/","name":"Prwatech","description":"Share Ideas, Start Something Good.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/prwatech.in\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/db90baff7744090b2288bbc98fea87f3","name":"Prwatech","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prwatech.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c00bafc1b04045f31eda917de39891456c44fa47c092b9bb6be0f860a3a30a2f?s=96&d=mm&r=g","caption":"Prwatech"},"url":"https:\/\/prwatech.in\/blog\/author\/prwatech123\/"}]}},"_links":{"self":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/9761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/comments?post=9761"}],"version-history":[{"count":10,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/9761\/revisions"}],"predecessor-version":[{"id":11517,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/posts\/9761\/revisions\/11517"}],"wp:attachment":[{"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/media?parent=9761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/categories?post=9761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prwatech.in\/blog\/wp-json\/wp\/v2\/tags?post=9761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}