{"id":159,"date":"2026-07-07T20:28:48","date_gmt":"2026-07-07T20:28:48","guid":{"rendered":"https:\/\/kindsonthegenius.com\/go\/2026\/07\/07\/04-go-variables-and-types\/"},"modified":"2026-07-08T19:18:41","modified_gmt":"2026-07-08T19:18:41","slug":"04-go-variables-and-types","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/go\/04-go-variables-and-types\/","title":{"rendered":"Go Variables and Types \u2013 Storing Data in Go"},"content":{"rendered":"<p><!-- ktg-updated-banner --><\/p>\n<div class=\"ktg-updated-banner\" style=\"margin:0 0 1.25em;padding:0.75em 1em;background:#fefce8;border-left:4px solid #ca8a04;border-radius:4px;\">\n<p><strong>Updated July 2, 2026.<\/strong> Refreshed for Go 1.22+ and current SEO best practices.<\/p>\n<\/div>\n<p>In this lesson we cover the <strong>Go variables tutorial<\/strong> essentials \u2014 how to declare variables, choose types, work with constants, and print formatted output. If you completed <a href=\"https:\/\/www.kindsonthegenius.com\/go\/03-go-basic-syntax\/\">Lesson 3 \u2013 Go Basic Syntax<\/a>, you already know the skeleton of a Go program. Here we add the data layer: names, types, and values that make programs useful.<\/p>\n<p><strong>Prerequisites:<\/strong> Go 1.22 or newer installed (<code>go version<\/code> in your terminal) and familiarity with <a href=\"https:\/\/www.kindsonthegenius.com\/go\/go-programming-setup\/\">Go Programming \u2013 Setup<\/a> and <a href=\"https:\/\/www.kindsonthegenius.com\/go\/03-go-basic-syntax\/\">Go Basic Syntax<\/a>. <strong>Estimated time:<\/strong> 35\u201345 minutes.<\/p>\n<h4 id=\"var-declaration\">1. Declaring Variables with var<\/h4>\n<p>The <code>var<\/code> keyword declares a variable and optionally assigns an initial value. You can declare one variable at a time or group several in a single block:<\/p>\n<pre><code class=\"language-go\">package main\n\nimport \"fmt\"\n\nfunc main() {\n\tvar name string\n\tname = \"Kindson\"\n\n\tvar age int = 30\n\tvar city = \"Lagos\" \/\/ type inferred as string\n\n\tvar (\n\t\tlanguage = \"Go\"\n\t\tyear     = 2026\n\t)\n\n\tfmt.Println(name, age, city, language, year)\n}\n<\/code><\/pre>\n<p>When you omit the initial value, Go assigns the <strong>zero value<\/strong> for that type (covered later). When you omit the type but provide a value, Go infers the type from the literal. Use <code>var<\/code> at package level or when you want an explicit type that inference might not capture cleanly.<\/p>\n<h4 id=\"short-declaration\">2. Short Variable Declaration with :=<\/h4>\n<p>Inside functions, the <code>:=<\/code> operator is the most common way to declare and initialize a variable in one step:<\/p>\n<pre><code class=\"language-go\">package main\n\nimport \"fmt\"\n\nfunc main() {\n\tmessage := \"Hello from Go\"\n\tcount := 42\n\tpi := 3.14159\n\tisReady := true\n\n\tfmt.Println(message, count, pi, isReady)\n}\n<\/code><\/pre>\n<p>Important rules for <code>:=<\/code>:<\/p>\n<ul>\n<li>It can only be used <strong>inside functions<\/strong> \u2014 not at package level.<\/li>\n<li>At least one variable on the left must be <strong>new<\/strong> in the current scope. You can reuse <code>:=<\/code> if one name is new: <code>count, err := doWork()<\/code>.<\/li>\n<li>Go always infers the type; you cannot write <code>x := int<\/code> without a value.<\/li>\n<\/ul>\n<p>If you are coming from <a href=\"https:\/\/www.kindsonthegenius.com\/python\/\">Python<\/a>, think of <code>:=<\/code> as similar to a first assignment that also creates the name \u2014 but Go is statically typed, so the type is fixed at declaration.<\/p>\n<h4 id=\"constants\">3. Constants<\/h4>\n<p>Constants are values that cannot change after compilation. Declare them with <code>const<\/code>:<\/p>\n<pre><code class=\"language-go\">package main\n\nimport \"fmt\"\n\nconst AppName = \"KindsonGo\"\nconst MaxUsers = 1000\n\nconst (\n\tStatusOK    = 200\n\tStatusError = 500\n)\n\nfunc main() {\n\tfmt.Println(AppName, MaxUsers, StatusOK)\n}\n<\/code><\/pre>\n<p>Constants must be compile-time values \u2014 numbers, strings, or boolean literals. You cannot assign the result of a function call to a <code>const<\/code>. For configuration that never changes (API version, buffer size, status codes), constants keep intent clear and prevent accidental reassignment.<\/p>\n<h4 id=\"basic-types\">4. Basic Types in Go<\/h4>\n<p>Go provides a small set of built-in types. Understanding them early prevents bugs when you mix integers, floats, and strings:<\/p>\n<table>\n<thead>\n<tr>\n<th>Category<\/th>\n<th>Type<\/th>\n<th>Example<\/th>\n<th>Notes<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Boolean<\/td>\n<td><code>bool<\/code><\/td>\n<td><code>true<\/code>, <code>false<\/code><\/td>\n<td>Used in conditions and logic<\/td>\n<\/tr>\n<tr>\n<td>String<\/td>\n<td><code>string<\/code><\/td>\n<td><code>\"hello\"<\/code><\/td>\n<td>UTF-8 text; immutable<\/td>\n<\/tr>\n<tr>\n<td>Integer<\/td>\n<td><code>int<\/code>, <code>int8<\/code>\u2026<code>int64<\/code><\/td>\n<td><code>42<\/code>, <code>-7<\/code><\/td>\n<td><code>int<\/code> size depends on platform (32 or 64 bit)<\/td>\n<\/tr>\n<tr>\n<td>Unsigned<\/td>\n<td><code>uint<\/code>, <code>byte<\/code> (<code>uint8<\/code>)<\/td>\n<td><code>255<\/code><\/td>\n<td>Non-negative only<\/td>\n<\/tr>\n<tr>\n<td>Floating<\/td>\n<td><code>float32<\/code>, <code>float64<\/code><\/td>\n<td><code>3.14<\/code><\/td>\n<td>Default untyped float is <code>float64<\/code><\/td>\n<\/tr>\n<tr>\n<td>Complex<\/td>\n<td><code>complex64<\/code>, <code>complex128<\/code><\/td>\n<td><code>1+2i<\/code><\/td>\n<td>Rare in everyday code<\/td>\n<\/tr>\n<tr>\n<td>Rune<\/td>\n<td><code>rune<\/code> (<code>int32<\/code>)<\/td>\n<td><code>'A'<\/code>, <code>'\u4e16'<\/code><\/td>\n<td>Represents a Unicode code point<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Start with <code>int<\/code>, <code>float64<\/code>, <code>string<\/code>, and <code>bool<\/code> for most programs. Reach for sized types (<code>int32<\/code>, <code>uint8<\/code>) when you care about memory layout or interoperability with other systems.<\/p>\n<h4 id=\"zero-values\">5. Zero Values<\/h4>\n<p>Every type in Go has a default value when you declare a variable without initializing it:<\/p>\n<ul>\n<li><code>0<\/code> for numeric types<\/li>\n<li><code>false<\/code> for <code>bool<\/code><\/li>\n<li><code>\"\"<\/code> (empty string) for <code>string<\/code><\/li>\n<li><code>nil<\/code> for pointers, slices, maps, channels, interfaces, and function types<\/li>\n<\/ul>\n<pre><code class=\"language-go\">package main\n\nimport \"fmt\"\n\nfunc main() {\n\tvar count int\n\tvar name string\n\tvar active bool\n\n\tfmt.Printf(\"count=%d, name=%q, active=%t\\n\", count, name, active)\n\t\/\/ Output: count=0, name=\"\", active=false\n}\n<\/code><\/pre>\n<p>Zero values mean Go never leaves variables in an undefined state \u2014 a safety feature compared to languages where uninitialized variables contain garbage. You will rely on zero values often when declaring structs and slices in later lessons.<\/p>\n<h4 id=\"type-conversion\">6. Type Conversion<\/h4>\n<p>Go does <strong>not<\/strong> perform implicit numeric conversions. You must convert explicitly:<\/p>\n<pre><code class=\"language-go\">package main\n\nimport \"fmt\"\n\nfunc main() {\n\tvar i int = 42\n\tvar f float64 = float64(i)\n\tvar u uint = uint(f)\n\n\tvar x int32 = 10\n\tvar y int64 = int64(x) + 50\n\n\tfmt.Println(i, f, u, y)\n}\n<\/code><\/pre>\n<p>Syntax is <code>Type(value)<\/code> \u2014 for example <code>int64(x)<\/code> or <code>string(65)<\/code> for rune-to-string (not for arbitrary int-to-string; use <code>strconv<\/code> for that). Mixing <code>int<\/code> and <code>float64<\/code> without conversion is a compile error, which catches precision bugs early.<\/p>\n<h4 id=\"printf\">7. Formatted Output with fmt.Printf<\/h4>\n<p><code>fmt.Println<\/code> prints values with spaces; <code>fmt.Printf<\/code> gives you control over format using <strong>verbs<\/strong>:<\/p>\n<pre><code class=\"language-go\">package main\n\nimport \"fmt\"\n\nfunc main() {\n\tname := \"Ada\"\n\tscore := 98.6\n\tpassed := true\n\n\tfmt.Printf(\"Name: %s\\n\", name)\n\tfmt.Printf(\"Score: %.1f\\n\", score)\n\tfmt.Printf(\"Passed: %t\\n\", passed)\n\tfmt.Printf(\"Type of score: %T\\n\", score)\n}\n<\/code><\/pre>\n<p>Common verbs: <code>%s<\/code> string, <code>%d<\/code> integer, <code>%f<\/code> float, <code>%t<\/code> boolean, <code>%v<\/code> default format, <code>%T<\/code> type, <code>%q<\/code> quoted string. Add <code>\\n<\/code> for a newline \u2014 <code>Printf<\/code> does not add one automatically. For quick debugging, <code>fmt.Printf(\"%+v\\n\", someValue)<\/code> is handy with structs later.<\/p>\n<h4 id=\"next\">8. Next Steps<\/h4>\n<p>You now understand <strong>Go variables and types<\/strong>: <code>var<\/code>, <code>:=<\/code>, constants, basic types, zero values, type conversion, and <code>fmt.Printf<\/code>. In the next lesson we cover <strong>control flow<\/strong> \u2014 <code>if<\/code>, <code>switch<\/code>, and <code>for<\/code> loops that branch and repeat logic based on your data.<\/p>\n<p>Continue the series: <a href=\"https:\/\/www.kindsonthegenius.com\/go\/go-programming-introduction\/\">Lesson 1 \u2013 Introduction<\/a> \u00b7 <a href=\"https:\/\/www.kindsonthegenius.com\/go\/go-programming-setup\/\">Lesson 2 \u2013 Setup<\/a> \u00b7 <a href=\"https:\/\/www.kindsonthegenius.com\/go\/03-go-basic-syntax\/\">Lesson 3 \u2013 Basic Syntax<\/a> \u00b7 <a href=\"https:\/\/www.kindsonthegenius.com\/go\/05-go-control-flow\/\">Lesson 5 \u2013 Control Flow<\/a><\/p>\n<p>Browse all tutorials: <a href=\"https:\/\/www.kindsonthegenius.com\/content-directory\/\">Content Directory<\/a> \u00b7 <a href=\"https:\/\/www.kindsonthegenius.com\/go\/\">Go Programming Hub<\/a><\/p>\n<h4 id=\"faq\">Frequently Asked Questions<\/h4>\n<p><strong>What is the difference between var and := in Go?<\/strong><br \/>\n<code>var<\/code> works at package level and inside functions; you can declare without a value. <code>:=<\/code> only works inside functions and requires an initial value while inferring the type.<\/p>\n<p><strong>Does Go have implicit type conversion?<\/strong><br \/>\nNo. You must convert between types explicitly with syntax like <code>float64(myInt)<\/code>. This prevents silent precision loss and unexpected behavior.<\/p>\n<p><strong>What are zero values in Go?<\/strong><br \/>\nZero values are defaults assigned when you declare a variable without initialization: <code>0<\/code> for numbers, <code>false<\/code> for booleans, <code>\"\"<\/code> for strings, and <code>nil<\/code> for reference types.<\/p>\n<p><!-- ktg-lesson-nav --><\/p>\n<nav class=\"ktg-lesson-nav\" aria-label=\"Lesson navigation\">\n<p><strong>Previous:<\/strong> <a href=\"https:\/\/kindsonthegenius.com\/go\/03-go-basic-syntax\/\">Lesson 3: Go Basic Syntax \u2013 Structure of a Go Program<\/a><\/p>\n<p><strong>Next:<\/strong> <a href=\"https:\/\/kindsonthegenius.com\/go\/05-go-control-flow\/\">Lesson 5: Go Control Flow \u2013 if, else, switch, and for Loops<\/a><\/p>\n<\/nav>\n<p><!-- ktg-alkademy-cta --><\/p>\n<div class=\"ktg-alkademy-cta\" style=\"margin:2em 0;padding:1.25em;border-left:4px solid #2563eb;background:#f8fafc;\">\n<p><strong>Want live Go or backend classes?<\/strong> Join <a href=\"https:\/\/www.alkademy.com\/courses\" target=\"_blank\" rel=\"noopener noreferrer\">Alkademy<\/a> for instructor-led programming courses with hands-on projects.<\/p>\n<\/div>\n<p><!-- ktg-faq-schema --><br \/>\n<script type=\"application\/ld+json\">{\"@context\":\"https:\/\/schema.org\",\"@type\":\"FAQPage\",\"mainEntity\":[{\"@type\":\"Question\",\"name\":\"What is the difference between var and := in Go?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"var declares a variable with an explicit type. := is short declaration with type inference.\"}},{\"@type\":\"Question\",\"name\":\"What are zero values in Go?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"Uninitialized variables get default values: 0 for numbers, false for bool, \\\"\\\" for strings, nil for pointers and slices.\"}},{\"@type\":\"Question\",\"name\":\"Can you change a variable's type in Go?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"No. Go is statically typed. Use type conversion explicitly when needed.\"}}]}<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Updated July 2, 2026. Refreshed for Go 1.22+ and current SEO best practices. In this lesson we cover the Go variables tutorial essentials \u2014 how &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[23],"tags":[],"class_list":["post-159","post","type-post","status-publish","format-standard","hentry","category-go-programming"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Go Variables and Types \u2013 Storing Data in Go | Go Programming Tutorial<\/title>\n<meta name=\"description\" content=\"Learn Go variables, constants, and data types \u2014 var, :=, zero values, and type conversion. Lesson 4 in the free Go programming tutorial with runnable code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kindsonthegenius.com\/go\/04-go-variables-and-types\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Go Variables and Types \u2013 Storing Data in Go | Go Programming Tutorial\" \/>\n<meta property=\"og:description\" content=\"Learn Go variables, constants, and data types \u2014 var, :=, zero values, and type conversion. Lesson 4 in the free Go programming tutorial with runnable code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kindsonthegenius.com\/go\/04-go-variables-and-types\/\" \/>\n<meta property=\"og:site_name\" content=\"Go Programming Tutorial\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-07T20:28:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-07-08T19:18:41+00:00\" \/>\n<meta name=\"author\" content=\"kindsonthegenius\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"kindsonthegenius\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/04-go-variables-and-types\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/04-go-variables-and-types\\\/\"},\"author\":{\"name\":\"kindsonthegenius\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/#\\\/schema\\\/person\\\/1b5971e6d80495780d9857f155fd1b21\"},\"headline\":\"Go Variables and Types \u2013 Storing Data in Go\",\"datePublished\":\"2026-07-07T20:28:48+00:00\",\"dateModified\":\"2026-07-08T19:18:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/04-go-variables-and-types\\\/\"},\"wordCount\":746,\"commentCount\":1,\"articleSection\":[\"Go Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/04-go-variables-and-types\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/04-go-variables-and-types\\\/\",\"url\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/04-go-variables-and-types\\\/\",\"name\":\"Go Variables and Types \u2013 Storing Data in Go | Go Programming Tutorial\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/#website\"},\"datePublished\":\"2026-07-07T20:28:48+00:00\",\"dateModified\":\"2026-07-08T19:18:41+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/#\\\/schema\\\/person\\\/1b5971e6d80495780d9857f155fd1b21\"},\"description\":\"Learn Go variables, constants, and data types \u2014 var, :=, zero values, and type conversion. Lesson 4 in the free Go programming tutorial with runnable code.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/04-go-variables-and-types\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/04-go-variables-and-types\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/04-go-variables-and-types\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Go Variables and Types \u2013 Storing Data in Go\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/#website\",\"url\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/\",\"name\":\"Go Programming Tutorial\",\"description\":\"Beginner to Expert Go Programming Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/#\\\/schema\\\/person\\\/1b5971e6d80495780d9857f155fd1b21\",\"name\":\"kindsonthegenius\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"caption\":\"kindsonthegenius\"},\"url\":\"https:\\\/\\\/kindsonthegenius.com\\\/go\\\/author\\\/kindsonthegenius-3\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Go Variables and Types \u2013 Storing Data in Go | Go Programming Tutorial","description":"Learn Go variables, constants, and data types \u2014 var, :=, zero values, and type conversion. Lesson 4 in the free Go programming tutorial with runnable code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kindsonthegenius.com\/go\/04-go-variables-and-types\/","og_locale":"en_US","og_type":"article","og_title":"Go Variables and Types \u2013 Storing Data in Go | Go Programming Tutorial","og_description":"Learn Go variables, constants, and data types \u2014 var, :=, zero values, and type conversion. Lesson 4 in the free Go programming tutorial with runnable code.","og_url":"https:\/\/kindsonthegenius.com\/go\/04-go-variables-and-types\/","og_site_name":"Go Programming Tutorial","article_published_time":"2026-07-07T20:28:48+00:00","article_modified_time":"2026-07-08T19:18:41+00:00","author":"kindsonthegenius","twitter_card":"summary_large_image","twitter_misc":{"Written by":"kindsonthegenius","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kindsonthegenius.com\/go\/04-go-variables-and-types\/#article","isPartOf":{"@id":"https:\/\/kindsonthegenius.com\/go\/04-go-variables-and-types\/"},"author":{"name":"kindsonthegenius","@id":"https:\/\/kindsonthegenius.com\/go\/#\/schema\/person\/1b5971e6d80495780d9857f155fd1b21"},"headline":"Go Variables and Types \u2013 Storing Data in Go","datePublished":"2026-07-07T20:28:48+00:00","dateModified":"2026-07-08T19:18:41+00:00","mainEntityOfPage":{"@id":"https:\/\/kindsonthegenius.com\/go\/04-go-variables-and-types\/"},"wordCount":746,"commentCount":1,"articleSection":["Go Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kindsonthegenius.com\/go\/04-go-variables-and-types\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kindsonthegenius.com\/go\/04-go-variables-and-types\/","url":"https:\/\/kindsonthegenius.com\/go\/04-go-variables-and-types\/","name":"Go Variables and Types \u2013 Storing Data in Go | Go Programming Tutorial","isPartOf":{"@id":"https:\/\/kindsonthegenius.com\/go\/#website"},"datePublished":"2026-07-07T20:28:48+00:00","dateModified":"2026-07-08T19:18:41+00:00","author":{"@id":"https:\/\/kindsonthegenius.com\/go\/#\/schema\/person\/1b5971e6d80495780d9857f155fd1b21"},"description":"Learn Go variables, constants, and data types \u2014 var, :=, zero values, and type conversion. Lesson 4 in the free Go programming tutorial with runnable code.","breadcrumb":{"@id":"https:\/\/kindsonthegenius.com\/go\/04-go-variables-and-types\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kindsonthegenius.com\/go\/04-go-variables-and-types\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/kindsonthegenius.com\/go\/04-go-variables-and-types\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kindsonthegenius.com\/go\/"},{"@type":"ListItem","position":2,"name":"Go Variables and Types \u2013 Storing Data in Go"}]},{"@type":"WebSite","@id":"https:\/\/kindsonthegenius.com\/go\/#website","url":"https:\/\/kindsonthegenius.com\/go\/","name":"Go Programming Tutorial","description":"Beginner to Expert Go Programming Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kindsonthegenius.com\/go\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/kindsonthegenius.com\/go\/#\/schema\/person\/1b5971e6d80495780d9857f155fd1b21","name":"kindsonthegenius","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","caption":"kindsonthegenius"},"url":"https:\/\/kindsonthegenius.com\/go\/author\/kindsonthegenius-3\/"}]}},"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/go\/wp-json\/wp\/v2\/posts\/159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/go\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/go\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/go\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/go\/wp-json\/wp\/v2\/comments?post=159"}],"version-history":[{"count":4,"href":"https:\/\/kindsonthegenius.com\/go\/wp-json\/wp\/v2\/posts\/159\/revisions"}],"predecessor-version":[{"id":244,"href":"https:\/\/kindsonthegenius.com\/go\/wp-json\/wp\/v2\/posts\/159\/revisions\/244"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/go\/wp-json\/wp\/v2\/media?parent=159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/go\/wp-json\/wp\/v2\/categories?post=159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/go\/wp-json\/wp\/v2\/tags?post=159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}