<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Adeola Ajiboso - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Adeola Ajiboso - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Tue, 02 Jun 2026 11:12:15 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/author/Adeola-Ajiboso/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Learn Golang – A Beginner's Guide to the Basics ]]>
                </title>
                <description>
                    <![CDATA[ The Go programming language, also known as Golang, was developed at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. It was open-sourced in 2009.  Go is expressive, concise, clean, and efficient. The language is statically typed with s... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/golang-for-beginners/</link>
                <guid isPermaLink="false">66c4791ec60b35701cd64b70</guid>
                
                    <category>
                        <![CDATA[ Go Language ]]>
                    </category>
                
                    <category>
                        <![CDATA[ golang ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Adeola Ajiboso ]]>
                </dc:creator>
                <pubDate>Thu, 08 Feb 2024 17:12:33 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/02/1.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The Go programming language, also known as Golang, was developed at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson. It was open-sourced in 2009. </p>
<p>Go is expressive, concise, clean, and efficient. The language is statically typed with syntax similar to the C programming language. </p>
<p>Go was designed to run on multiple cores, and it was built to support concurrency. You can use Go to write applications that need to be performant and can run on a modern scale, like distributed systems with hundreds of thousands of servers on a cloud platform.  </p>
<p>In this article, you'll learn how to write a basic CLI (Command Line Interface) application in Go. First, we'll briefly go over some main Go characteristics. Then we'll talk about the basic structure of a Go file. Lastly, you'll learn how to set up Go locally to write code. </p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><a class="post-section-overview" href="#heading-characteristics-of-go">Characteristics of Go</a></li>
<li><a class="post-section-overview" href="#heading-how-to-set-up-go-locally-on-windows">How to Set Up Go Locally on Windows</a> </li>
<li><a class="post-section-overview" href="#how-to-get-started-with-writing-code-in-go">How to Get Started With Writing Code in Go</a></li>
<li><a class="post-section-overview" href="#heading-what-are-packages-in-go">What Are Packages in Go?</a></li>
<li><a class="post-section-overview" href="#heading-what-are-modules-in-go">What Are Modules in Go?</a></li>
<li><a class="post-section-overview" href="#heading-what-is-the-go-command">What is the Go Command?</a></li>
<li><a class="post-section-overview" href="#heading-what-are-variables-in-go">What are Variables in Go?</a></li>
<li><a class="post-section-overview" href="#heading-naming-conventions-in-go">Naming Conventions in Go</a></li>
<li><a class="post-section-overview" href="#differences-between-the-var-and-const-keywords">Differences Between the <code>var</code> Keyword and <code>const</code> Keywords</a></li>
<li><a class="post-section-overview" href="#heading-data-types-in-go">Data Types in Go</a></li>
<li><a class="post-section-overview" href="#heading-operators-in-go">Operators in Go</a></li>
<li><a class="post-section-overview" href="#heading-wrapping-up">Wrapping Up</a></li>
</ul>
<h2 id="heading-characteristics-of-go">Characteristics of Go</h2>
<h3 id="heading-go-is-used-as-server-side-and-backend-language">Go is used as server-side and backend language</h3>
<p>Go is commonly used to build server-side applications and backend services. This includes a wide range of applications such as microservices, web applications, API servers, and database services.</p>
<p>Go is designed with concurrency in mind, making it well-suited for building scalable and efficient server-side applications. Its simplicity, performance, and built-in support for concurrency make it a favorable choice for backend development.</p>
<h3 id="heading-go-uses-simple-syntax">Go uses simple syntax</h3>
<p>Go has a straightforward and minimalistic syntax. It's intentionally designed to be easy to learn, read, and write code. Go encourages a clean and concise coding style.</p>
<p>A simple syntax reduces the load on developers, making it easier for them to understand and maintain code.</p>
<h3 id="heading-go-has-fast-build-time-startup-and-run-time">Go has fast build time, startup, and run time</h3>
<p>Go's compilation process is quick, allowing developers to see the results of their code changes rapidly.</p>
<p>Also, Go programs generally start up quickly and have efficient runtime performance.</p>
<h3 id="heading-go-is-resource-efficient">Go is resource efficient</h3>
<p>Go programs typically require fewer system resources like CPU and RAM to run compared to some other languages. This is partly due to Go's statically compiled nature and efficient runtime.</p>
<p>Lower resource requirements make Go well-suited for building applications that need to be lightweight and efficient, particularly in environments where resources are limited. It contributes to better scalability and cost-effectiveness in server deployments.</p>
<h3 id="heading-go-is-a-compiled-language">Go is a compiled language</h3>
<p>Go is a compiled language, meaning that source code is translated into machine code or an intermediate form before execution. This is in contrast to interpreted languages where code is executed directly by an interpreter.</p>
<p>Compilation offers advantages such as faster execution, as the code is pre-processed into a form that the machine can directly execute. It also ensures that potential errors are caught during the compilation phase, reducing runtime errors and improving overall program reliability.</p>
<h2 id="heading-how-to-set-up-go-locally-on-windows">How to Set Up Go Locally on Windows</h2>
<h3 id="heading-install-go-on-your-system">Install Go on your System</h3>
<p>Before installing Go, open up your command prompt, type “go” and hit enter.  This is to confirm whether you have Go installed on your PC or not.</p>
<p>When you enter “go” and hit enter, you should get a message that says “'go' is not recognized as an internal or external command, operable program or batch file”.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-4.png" alt="Image" width="600" height="400" loading="lazy">
<em>Command Prompt Interface</em></p>
<p>This means you need to install it.</p>
<p>To install Go on your Windows computer, you have to first <a target="_blank" href="https://go.dev/doc/install">download Golang</a> from the official website. It supports all main operating systems. Install the one that corresponds with your operating system.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image.png" alt="Image" width="600" height="400" loading="lazy">
<em>Golang Official Website Interface</em></p>
<p>Next, double-click on the downloaded installer to install Go. Follow the prompts accordingly and Go will be installed.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-5.png" alt="Image" width="600" height="400" loading="lazy">
<em>Go installer Interface</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-6.png" alt="Image" width="600" height="400" loading="lazy">
<em>Golang Installer Interface</em></p>
<p>After installing Go, return to the command line and type "go" again. This time, you should see numerous commands in Go.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-8.png" alt="Image" width="600" height="400" loading="lazy">
<em>Command prompt to show Go installation Completion</em></p>
<p>Now you'll need to set up your Go workspace by configuring environment variables. Go to your desktop and create a folder called "go-projects" (you can call it whatever you like). This is the folder where your Go projects will be saved. </p>
<p>First, search for “env” on the Windows searchbar and click on “Edit the system environment variables”.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-9.png" alt="Image" width="600" height="400" loading="lazy">
<em>Search for Edit the system environment variables</em></p>
<p>Click on the Environment variables button, as you can see below:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-10.png" alt="Image" width="600" height="400" loading="lazy">
<em>Click on the Environment variables button</em></p>
<p>You will have to change the value of the <code>GOPATH</code> variable to the folder you created earlier.</p>
<p>Make sure “GOPATH” is selected, then click “Edit…”.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-11.png" alt="Image" width="600" height="400" loading="lazy">
<em>Select GOPATH</em></p>
<p>Click on “Browse Directory”</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-14.png" alt="Image" width="600" height="400" loading="lazy">
<em>Click on “Browse Directory”</em></p>
<p>Select the folder you created earlier (“go-projects”, or whatever you named yours) and click "OK".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-16.png" alt="Image" width="600" height="400" loading="lazy">
<em>Select the folder you created earlier</em></p>
<p>Click "OK" again.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-17.png" alt="Image" width="600" height="400" loading="lazy">
<em>Click OK</em></p>
<p>Click "OK" again.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-18.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Click "OK" one more time.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-20.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Voilà! You are done setting the GOPATH variable. </p>
<h3 id="heading-set-up-an-ide">Set Up an IDE</h3>
<p>Install an IDE (Integrated Development Environment) of your choice if you don't have one installed already. </p>
<p>An IDE is an editor for writing Code, like Visual Studio Code, Sublime, and so on.<br><a target="_blank" href="https://code.visualstudio.com/download">Here is the link to download Visual Studio Code</a>.</p>
<h3 id="heading-install-the-go-extension-in-vs-code">Install the Go Extension in VS Code</h3>
<p>Next, you'll want to install the Go extension on Visual Studio Code. It provides features like code completion, code navigation, syntax highlighting, and snippet suggestions.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/Go-extension.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Go extension</em></p>
<h2 id="heading-how-to-get-started-writing-code-in-go">How to Get Started Writing Code in Go</h2>
<p>Open up the “go-projects” folder (or whatever you named it) with VS Code (or your code editor of choice). Create a folder called "hello-world" (this is optional) and create a file named <code>main.go</code>. You can name the file whatever you want.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/How-To-Write-Code-in-Go.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Example Go code</em></p>
<p>Here's the output:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-29.png" alt="Image" width="600" height="400" loading="lazy">
<em>Output</em></p>
<p>You might be wondering what the code snippet above is doing 🤔. I'll explain in detail below.</p>
<p>Let's go 🚀🚀</p>
<ul>
<li><strong>Package Declaration (<code>package main</code>):</strong> Every Go program starts with a package declaration, indicating to which package the file belongs. The <code>main</code> package is a special one, as it's the entry point for executable programs.</li>
<li><strong>Import Statement (<code>import "fmt"</code>):</strong> In Go, you import packages to use their functions and features. Here, we import the <code>fmt</code> package, which stands for "format" and is used for input and output operations.</li>
<li><strong>Main Function (<code>func main()</code>):</strong> Every Go executable program must have a <code>main</code> function. When you run your program, it's the first function that gets executed.</li>
<li><strong>Print Statement (<code>fmt.Println("Hello World")</code>):</strong> This line uses the <code>Println</code> function from the <code>fmt</code> package to print the text "Hello World" to the console. The <code>Println</code> function is used for printing with a newline character at the end, so the next output appears on a new line.</li>
</ul>
<h3 id="heading-what-are-packages-in-go">What are Packages in Go?</h3>
<p>Packages are Go's way of organizing code. A package is a collection of source files. It should be narrowly focused and perform a single thing like argument passing, handling HTTP request, and so on.  </p>
<p>Programs start running in <code>package main</code>. This program uses the packages with import paths <code>“fmt”</code>.</p>
<p>In Go, <strong>import path</strong> is a unique identifier for a package. It specifies the location of a package in the Go module system. The import path is used in the <code>import</code> statement to bring in external packages or dependencies into your Go code.</p>
<p>Here's a breakdown of the import path:</p>
<p><strong>Standard Library Packages:</strong> For packages that are part of the Go standard library, you can directly use their name in the import statement. </p>
<p>For example:</p>
<pre><code class="lang-go"><span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>
</code></pre>
<p><strong>Local Packages:</strong> If you are working on a project with multiple files or packages, you can use relative import paths to import local packages. </p>
<p>For example, if you have a package named "mypackage" in the same directory as your main file, you can import it like this:</p>
<pre><code class="lang-go"><span class="hljs-keyword">import</span> <span class="hljs-string">"./mypackage"</span>
</code></pre>
<p><strong>Remote Packages (from version control repositories):</strong> Go supports importing packages directly from version control repositories like GitHub. The import path includes the repository URL. </p>
<p>For example:</p>
<pre><code class="lang-go"><span class="hljs-keyword">import</span> <span class="hljs-string">"github.com/example/mypackage"</span>
</code></pre>
<p><strong>Remote Packages (from custom servers):</strong> You can also import packages from custom servers by specifying the full URL. </p>
<p>For instance:</p>
<pre><code class="lang-go"><span class="hljs-keyword">import</span> <span class="hljs-string">"myserver.com/mypackage"</span>
</code></pre>
<p><strong>Vendored Packages:</strong> If you have a vendored package (a copy of a package kept within your project's repository), you can import it using a path relative to your project root. </p>
<p>For example:</p>
<pre><code class="lang-go"><span class="hljs-keyword">import</span> <span class="hljs-string">"myproject/vendor/mypackage"</span>
</code></pre>
<p><strong>Packages from the Go Module Cache:</strong> With the introduction of Go modules, when using modules, Go automatically caches the dependencies in a module cache. Import paths can refer to packages in the cache. </p>
<p>For example:</p>
<pre><code class="lang-go"><span class="hljs-keyword">import</span> <span class="hljs-string">"example.com/mypackage"</span>
</code></pre>
<p><code>package main</code> is always written as the top of your code as shown below </p>
<p>Here's an example below:</p>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span>{
    fmt.Println(<span class="hljs-string">"Hello World"</span>)
 }
</code></pre>
<h3 id="heading-what-are-modules-in-go"><strong>What Are Modules in Go?</strong></h3>
<p>A module is a collection of packages. It contains information about your project like dependencies, the Go version, and package info. All Go projects have a go.mod file.</p>
<p>Here is the command for initializing the <code>go.mod</code> file from the terminal:</p>
<pre><code class="lang-go"><span class="hljs-keyword">go</span> mod init &lt;module path&gt;
</code></pre>
<p><code>module path</code> is also the <strong>import path</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-25.png" alt="Image" width="600" height="400" loading="lazy">
<em>How to initialize <code>go.mod</code> from the terminal</em></p>
<p>The picture above shows how modules are created right from the terminal. And this is the generated <code>go.mod</code> file:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-26.png" alt="Image" width="600" height="400" loading="lazy">
<em>Screenshot of the <code>go.mod</code> content</em></p>
<h3 id="heading-what-is-the-go-command">What is the <code>Go</code> Command?</h3>
<p>The "Go command" refers to the <code>go</code> command-line tool in the Go programming language. It's a versatile tool that you can use to perform various tasks related to Go development such as compiling, testing, installing packages, managing dependencies, and more.</p>
<h4 id="heading-what-does-the-go-command-do">What does the <code>go</code> command do?</h4>
<p>The <code>go</code> command automates many aspects of the Go development workflow. It handles tasks like compiling, testing, dependency management, and more, making it easy for developers to build, test, and maintain Go projects. It also facilitates the adoption of Go modules, a dependency management system introduced to improve versioning and dependency tracking in Go projects.</p>
<p>You use the <code>go</code> command in various scenarios during the development lifecycle of a Go project:</p>
<ul>
<li><strong>Running Code:</strong> <code>go run</code> compiles and executes a Go program.</li>
<li><strong>Building Executables:</strong> <code>go build</code> compiles Go source code into an executable binary.</li>
<li><strong>Testing Code:</strong> <code>go test</code> runs tests in the current package and <code>go test ./...</code> runs tests in all subdirectories.</li>
<li><strong>Package Management (with Modules):</strong> <code>go mod init</code> initializes a new module (Go project) and creates a <code>go.mod</code> file. <code>go get</code> downloads and installs packages and dependencies. <code>go mod tidy</code> removes any dependencies that are no longer necessary. And <code>go list -m all</code> lists all dependencies for the current module.</li>
<li><strong>Documentation:</strong> <code>go doc</code> shows documentation for a package or symbol.</li>
<li><strong>Dependency Analysis:</strong> <code>go list</code> lists information about available packages. <code>go list -m -versions &lt;module&gt;</code> lists all known versions of a module.</li>
<li><strong>Code Formatting:</strong> <code>go fmt</code> formats Go source code.</li>
<li><strong>Environment:</strong> <code>go env</code> prints Go environment information.</li>
</ul>
<h3 id="heading-what-are-variables-in-go">What are Variables in Go?</h3>
<p>Variables provide a way to store and access data in your program.</p>
<p>To create a variable, you can use single creation, compound creation, block creation, or the create and assign method. Let's go through examples of each of them now.</p>
<h4 id="heading-single-creation">Single Creation</h4>
<p>Single Creation is used when you need to create and initialize a single variable.</p>
<p>Example of using the single creation method:</p>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">var</span> singleVariable <span class="hljs-keyword">int</span>
    singleVariable = <span class="hljs-number">10</span>
    fmt.Println(singleVariable)
}
</code></pre>
<p>In this example, <code>singleVariable</code> is declared and later assigned the value <code>10</code>.</p>
<h4 id="heading-compound-creation">Compound Creation</h4>
<p>We can also create multiple variables at the same time. This way of creating variables makes it simple to assign multiple different data types to multiple variables.</p>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">var</span> a, b, c  = <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-string">"Coders"</span>
    fmt.Println(a, b, c)
}
</code></pre>
<h4 id="heading-block-creation">Block Creation</h4>
<p>Block creation is used when you want to limit the scope of the variables to a specific block. You declare and initialize multiple variables within a code block <code>{}</code>.</p>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    {
        <span class="hljs-keyword">var</span> blockVariable <span class="hljs-keyword">int</span>
        blockVariable = <span class="hljs-number">5</span>
        fmt.Println(blockVariable)
    }

    <span class="hljs-comment">// blockVariable is not accessible here</span>
}
</code></pre>
<p>In this example, <code>blockVar1</code> is only accessible within the block it is declared.</p>
<h4 id="heading-create-and-assign">Create and Assign</h4>
<p>You declare and initialize a variable in a single line using the <code>:=</code> shorthand, like this:</p>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    createAndAssignVar := <span class="hljs-number">42</span>
    fmt.Println(createAndAssignVar)
}
</code></pre>
<p>In this example, <code>createAndAssignVar</code> is declared and initialized in a single line using the <code>:=</code> shorthand.</p>
<h3 id="heading-naming-conventions-in-go">Naming Conventions in Go</h3>
<p>Go variable naming uses camel case. For instance:</p>
<pre><code class="lang-go"><span class="hljs-keyword">const</span> myVariable = <span class="hljs-number">20</span>
</code></pre>
<p>Whenever you are coming up with a variable name, it's a good practice to give it a descriptive name, for example <code>conferenceName := "Linux"</code> instead of <code>conference := "Linux"</code>.</p>
<h3 id="heading-difference-between-var-keyword-and-const-keyword-in-go">Difference Between <code>var</code> Keyword and <code>const</code> Keyword in Go</h3>
<p>There are two ways to declare variables in Go: <code>var</code> and <code>const</code>. For those of you who know JavaScript, this may sound familiar.</p>
<ul>
<li><code>var</code> is used to declare variables, and their values can be changed after the declaration.</li>
<li><code>const</code> is used to declare constants, and their values cannot be changed after the declaration.</li>
</ul>
<p>Here's an example of using both <code>var</code> and <code>const</code> to declare variables:</p>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    <span class="hljs-comment">// Using var</span>
    <span class="hljs-keyword">var</span> variable1 <span class="hljs-keyword">int</span> = <span class="hljs-number">5</span>
    variable1 = <span class="hljs-number">10</span>  <span class="hljs-comment">// Valid, the value of variable1 can be changed</span>

    <span class="hljs-comment">// Using const</span>
    <span class="hljs-keyword">const</span> constant1 <span class="hljs-keyword">int</span> = <span class="hljs-number">5</span>
    <span class="hljs-comment">// constant1 = 10  // Invalid, constants cannot be reassigned</span>

    fmt.Println(variable1, constant1)
}
</code></pre>
<p>In the example above, <code>variable1</code> can be reassigned to a new value, while <code>constant1</code> cannot be reassigned due to its <code>const</code> nature.</p>
<h3 id="heading-data-types-in-go">Data Types in Go</h3>
<p>There are different data types in Golang, which include <code>number</code>, <code>string</code>, <code>boolean</code>, <code>array</code>, <code>pointer</code>, <code>struct</code>, <code>map</code>, and <code>interface</code>.</p>
<p>Let's see examples of each of these so you can learn how they work.</p>
<ul>
<li><code>Number</code> ( int, float64) is used  for representing numerical values (whole numbers or decimals). Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    <span class="hljs-comment">// Integers</span>
    <span class="hljs-keyword">var</span> integerVar <span class="hljs-keyword">int</span> = <span class="hljs-number">42</span>
    fmt.Println(integerVar)

    <span class="hljs-comment">// Floating-point numbers</span>
    <span class="hljs-keyword">var</span> floatVar <span class="hljs-keyword">float64</span> = <span class="hljs-number">3.14</span>
    fmt.Println(floatVar)
}
</code></pre>
<p>In this example, <code>integerVar</code> is an integer variable, and <code>floatVar</code> is a floating-point variable.</p>
<ul>
<li><code>String</code> is used for representing sequences of characters (text). Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">var</span> stringVar <span class="hljs-keyword">string</span> = <span class="hljs-string">"Hello, Golang!"</span>
    fmt.Println(stringVar)
}
</code></pre>
<p>In this example, <code>stringVar</code> is a string variable holding the text "Hello, Golang!".</p>
<ul>
<li><code>Boolean</code> is used for representing logical values (<code>true</code> or <code>false</code>). Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main
<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>
<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">var</span> boolVar <span class="hljs-keyword">bool</span> = <span class="hljs-literal">true</span>
    fmt.Println(boolVar)
}
</code></pre>
<p>In this example, <code>boolVar</code> is a boolean variable set to <code>true</code>.</p>
<ul>
<li><code>Array</code> is used for storing fixed-size sequences of elements of the same type. Here's an example</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">var</span> intArray [<span class="hljs-number">3</span>]<span class="hljs-keyword">int</span> = [<span class="hljs-number">3</span>]<span class="hljs-keyword">int</span>{<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>}
    fmt.Println(intArray)
}
</code></pre>
<p>In this example, <code>intArray</code> is an array of integers with a fixed size of 3. </p>
<ul>
<li><code>Pointer</code> is used for storing the memory address of a variable. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">var</span> originalVar <span class="hljs-keyword">int</span> = <span class="hljs-number">42</span>
    <span class="hljs-keyword">var</span> pointerVar *<span class="hljs-keyword">int</span> = &amp;originalVar
    fmt.Println(*pointerVar) <span class="hljs-comment">// Dereferencing the pointer</span>
}
</code></pre>
<p>In this example, <code>pointerVar</code> is a pointer to the memory address of <code>originalVar</code>. </p>
<ul>
<li><code>Structure (Struct)</code> is used for grouping together variables of different types under a single name. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-keyword">type</span> Person <span class="hljs-keyword">struct</span> {
    Name <span class="hljs-keyword">string</span>
    Age  <span class="hljs-keyword">int</span>
}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">var</span> personVar Person = Person{Name: <span class="hljs-string">"Alice"</span>, Age: <span class="hljs-number">30</span>}
    fmt.Println(personVar)
}
</code></pre>
<p>In this example, <code>personVar</code> is a struct representing a person with a name and an age </p>
<ul>
<li><code>Map</code> is used for representing key-value pairs. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">var</span> myMap <span class="hljs-keyword">map</span>[<span class="hljs-keyword">string</span>]<span class="hljs-keyword">int</span> = <span class="hljs-keyword">map</span>[<span class="hljs-keyword">string</span>]<span class="hljs-keyword">int</span>{<span class="hljs-string">"one"</span>: <span class="hljs-number">1</span>, <span class="hljs-string">"two"</span>: <span class="hljs-number">2</span>, <span class="hljs-string">"three"</span>: <span class="hljs-number">3</span>}
    fmt.Println(myMap)
}
</code></pre>
<p>In this example, <code>myMap</code> is a map with string keys and integer values. </p>
<ul>
<li><code>Interface</code> is used for defining a set of method signatures without specifying the implementation. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-keyword">type</span> Shape <span class="hljs-keyword">interface</span> {
    Area() <span class="hljs-keyword">float64</span>
}

<span class="hljs-keyword">type</span> Circle <span class="hljs-keyword">struct</span> {
    Radius <span class="hljs-keyword">float64</span>
}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-params">(c Circle)</span> <span class="hljs-title">Area</span><span class="hljs-params">()</span> <span class="hljs-title">float64</span></span> {
    <span class="hljs-keyword">return</span> <span class="hljs-number">3.14</span> * c.Radius * c.Radius
}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
    <span class="hljs-keyword">var</span> myShape Shape = Circle{Radius: <span class="hljs-number">5.0</span>}
    fmt.Println(myShape.Area())
}
</code></pre>
<p>In this example, <code>Shape</code> is an interface, and <code>Circle</code> is a type implementing the <code>Area</code> method of the <code>Shape</code> interface.</p>
<h3 id="heading-operators-in-go">Operators in Go</h3>
<p>There are 3 main types of operators in Go: arithmetic operators, logical operators, and relational operators</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/Operators--1-.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Now let's go through each category of operators and see how they work, with examples.</p>
<h4 id="heading-arithmetic-operators">Arithmetic Operators</h4>
<p>Arithmetic operators are used when you need to perform basic mathematical operations in your code. They include the following:</p>
<ul>
<li><strong>Addition (+)</strong> is used for adding numerical values together. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span> <span class="hljs-params">()</span></span>{    
    a := <span class="hljs-number">5</span>    
    b := <span class="hljs-number">3</span>    
    result := a + b  
    <span class="hljs-comment">// result is 8</span>
fmt.Println(result)
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-39.png" alt="Image" width="600" height="400" loading="lazy">
<em>How to use the Addition operator in Go</em></p>
<ul>
<li><strong>Subtraction (-)</strong> is used for finding the difference between two numerical values. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span> <span class="hljs-params">()</span></span>{
    a := <span class="hljs-number">8</span>
    b := <span class="hljs-number">3</span>
    result := a - b
    <span class="hljs-comment">// result is 5</span>
fmt.Println(result)
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-40.png" alt="Image" width="600" height="400" loading="lazy">
<em>How to use the Subtraction operator</em></p>
<ul>
<li><strong>Multiplication (*)</strong> is used for calculating the product of two numerical values. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span> <span class="hljs-params">()</span></span>{ 
    a := <span class="hljs-number">4</span>
    b := <span class="hljs-number">6</span>
    result := a * b
<span class="hljs-comment">// result is 24</span>
fmt.Println(result)
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-41.png" alt="Image" width="600" height="400" loading="lazy">
<em>How to use the Multiplication operator</em></p>
<ul>
<li><strong>Division (/)</strong> is used for calculating the quotient of two numerical values. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span>{
    a := <span class="hljs-number">10</span>
    b := <span class="hljs-number">2</span>
    result := a / b
<span class="hljs-comment">// result is 5</span>
fmt.Println(result)
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-42.png" alt="Image" width="600" height="400" loading="lazy">
<em>How to use the division operator</em></p>
<ul>
<li><strong>Modulus (%)</strong> returns the remainder of the division of the left operand by the right operand. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span> <span class="hljs-params">()</span></span>{
    a := <span class="hljs-number">15</span>
    b := <span class="hljs-number">7</span>
    result := a % b
fmt.Println(result)
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-43.png" alt="Image" width="600" height="400" loading="lazy">
<em>How to use the Modulus operator</em></p>
<h4 id="heading-relational-operators">Relational Operators</h4>
<p>Relational operators are used for comparing values and making decisions based on the comparison results. It includes the following:</p>
<ul>
<li><strong>Greater Than (&gt;)</strong> is used for comparisons where the left operand is greater than the right operand. Here's an example</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span> <span class="hljs-params">()</span></span>{
    x := <span class="hljs-number">8</span>
    y := <span class="hljs-number">5</span>
    isGreater := x &gt; y
<span class="hljs-comment">// isGreater is true</span>
fmt.Println(isGreater)
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-44.png" alt="Image" width="600" height="400" loading="lazy">
<em>How to use the Greater than sign</em></p>
<ul>
<li><strong>Less Than (&lt;)</strong> is used for comparisons where the left operand is less than the right operand. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span> <span class="hljs-params">()</span></span>{
    p := <span class="hljs-number">12</span>
    q := <span class="hljs-number">18</span>
    isLess := p &lt; q
    <span class="hljs-comment">// isLess is true</span>
fmt.Println(isLess)

]
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-45.png" alt="Image" width="600" height="400" loading="lazy">
<em><strong>How to use the less than sign</strong></em></p>
<ul>
<li><strong>Greater Than or equal (&gt;=)</strong> checks if the left operand is greater than or equal to the right operand. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span> <span class="hljs-params">()</span></span>{
    m := <span class="hljs-number">5</span>
    n := <span class="hljs-number">5</span>
    isGreaterOrEqual := m &gt;= n
    <span class="hljs-comment">// isGreaterOrEqual is true</span>
fmt.Println(isGreaterOrEqual)
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-46.png" alt="Image" width="600" height="400" loading="lazy">
<em><strong>How to use the greater than or equal sign</strong></em></p>
<ul>
<li><strong>Less Than or Equal to (&lt;=)</strong> checks if the left operand is less than or equal to the right operand.</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span> <span class="hljs-params">()</span></span>{
    r := <span class="hljs-number">10</span>
    s := <span class="hljs-number">15</span>
    isLessOrEqual := r &lt;= s
    <span class="hljs-comment">// isLessOrEqual is true</span>
fmt.Println(isLessOrEqual)
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-47.png" alt="Image" width="600" height="400" loading="lazy">
<em>How to use the less than or equal sign</em></p>
<ul>
<li><strong>Equivalence (==)</strong> checks if the left operand is equal to the right operand. You use this for equality comparisons. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span> <span class="hljs-params">()</span></span>{
    age := <span class="hljs-number">25</span>
    checkAge := age == <span class="hljs-number">25</span>
    <span class="hljs-comment">// checkAge is true</span>
fmt.Println(checkAge)
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-48.png" alt="Image" width="600" height="400" loading="lazy">
<em>How to use the Equivalence sign</em></p>
<ul>
<li><strong>Not Equal (!=)</strong> checks if the two operands are not equal. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span> <span class="hljs-params">()</span></span>{
    score1 := <span class="hljs-number">80</span>
    passingScore := score1 != <span class="hljs-number">75</span>
    <span class="hljs-comment">// passingScore is true</span>
fmt.Println(passingScore)
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-49.png" alt="Image" width="600" height="400" loading="lazy">
<em><strong>How to use the Not Equal</strong></em></p>
<h4 id="heading-logical-operators">Logical Operators</h4>
<p>You use logical operators when you need to implement boolean logic and make decisions based on multiple conditions.</p>
<ul>
<li><strong>Logical AND (&amp;&amp;):</strong> This operator returns true only if both operands are true, otherwise, it returns false. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span> <span class="hljs-params">()</span></span>{
    x := <span class="hljs-literal">true</span>
    y := <span class="hljs-literal">false</span>
    result := x &amp;&amp; y
    <span class="hljs-comment">// result is false</span>
fmt.Println(result)
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-50.png" alt="Image" width="600" height="400" loading="lazy">
<em>Example of Logical AND</em></p>
<ul>
<li><strong>Logical OR (||):</strong> This operator returns true if at least one of the operands is true, otherwise, it returns false. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span> <span class="hljs-params">()</span></span>{
    a := <span class="hljs-literal">true</span>
    b := <span class="hljs-literal">false</span>
    result := a || b
<span class="hljs-comment">// result is true</span>
fmt.Println(result)
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/image-51.png" alt="Image" width="600" height="400" loading="lazy">
<em>Example of logical OR</em></p>
<ul>
<li><strong>Logical NOT (!):</strong> This operator is a unary operator, meaning it operates on only one operand. It negates the value of the operand, turning true into false and false into true. Here's an example:</li>
</ul>
<pre><code class="lang-go"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> <span class="hljs-string">"fmt"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span> <span class="hljs-params">()</span></span>{
    isSunny := <span class="hljs-literal">true</span>
    isRainy := !isSunny
    <span class="hljs-comment">// isRainy is false</span>
fmt.Println(isRainy)
}
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/02/Logical-not.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Logical NOT example</em></p>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>In this article, you learned about the Go programming language and why it is useful to know. You also learned about the characteristics of Go and how to set up Go locally on Windows.</p>
<p>Then you learned how to actually get started writing code in Go, and you saw examples of many of Go's features in action. We also talked about what packages are, how modules work, and more.</p>
<p>Go is well worth your time. Now, go study some more Go.</p>
<p>Happy Coding!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Web Accessibility Tips for Developers – A11y Principles Explained ]]>
                </title>
                <description>
                    <![CDATA[ Accessibility isn't just something you check off as done when you're building websites and web apps. It's a basic part of making the online world a better and fairer place for everyone.  In this article, you'll learn what accessibility means, and why... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/web-accessibility-for-devs/</link>
                <guid isPermaLink="false">66c47922d83968d1c78c3913</guid>
                
                    <category>
                        <![CDATA[ a11y ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Accessibility ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Adeola Ajiboso ]]>
                </dc:creator>
                <pubDate>Thu, 02 Nov 2023 14:17:51 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/10/51314.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Accessibility isn't just something you check off as done when you're building websites and web apps. It's a basic part of making the online world a better and fairer place for everyone. </p>
<p>In this article, you'll learn what accessibility means, and why it's important to make accessibility a part of your regular workflow. I'll also give you practical tips with examples to make your websites more accessible. </p>
<p>Let's explore the key parts of web accessibility together and help you make a website that includes everyone.</p>
<h2 id="heading-what-is-web-accessibility">What is Web Accessibility?</h2>
<p><a target="_blank" href="https://www.freecodecamp.org/news/accessibility-best-practices-to-make-web-apps-accessible/">Web accessibility</a> refers to the practice of designing and developing websites, applications, and digital content in a way that ensures people with disabilities can perceive, understand, navigate, and interact with them effectively.</p>
<h2 id="heading-principles-of-web-accessibility">Principles of Web Accessibility</h2>
<p>To effectively enhance the accessibility of your websites and apps, you'll want to follow these fundamental principles outlined by the Web Content Accessibility Guidelines (<a target="_blank" href="https://www.w3.org/WAI/WCAG21/quickref/?versions=2.0">WCAG</a>):</p>
<h3 id="heading-is-it-perceivable">Is it Perceivable?</h3>
<p>Content should be displayed in a manner that all users can understand, regardless of their sensory abilities. Here are some ways you can make your content more perceivable:</p>
<p>First, you can provide captions for audio and video materials. Adding captions to your website or application allows those with hearing disabilities to understand the information being shared, and make the content more accessible to everyone.</p>
<p>You can see an example of adding captions to a video in the image below: </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/img.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Image of a video illustrating the use of captions.</em></p>
<p>Next, make sure you use proper color contrast for text and background elements.</p>
<p>Colors are an important part of a website, and we can describe them in terms of hue, lightness, and saturation.  </p>
<p>There are several categories of colors which include warm colors, cool colors, and neutral colors</p>
<p><strong>Warm Colors:</strong> Warm colors include red, orange, and yellow, and variations of<br>those three colors. These are the colors of fire, fall leaves, sunsets, and sunrises, and are generally energizing, passionate, and positive. </p>
<p><strong>Cool Colors:</strong> Cool colors include green, blue, and purple, are often more<br>subdued than warm colors. They are the colors of night, water, of nature, and are usually calming, relaxing, and somewhat reserved.</p>
<p><strong>Neutral Colors:</strong> Neutral colors often serve as the backdrop in design. They’re<br>commonly combined with brighter accent colors. But they can also be used on their own in designs and can create very sophisticated layouts. Neutral colors include black, white, gray, cream, and beige.  </p>
<p>Examples of colors that will make good contrast are white and blue, purple and white, yellow and white, light purple and black, green and white, black and white, and so on – basically any colors that are different enough from each other to create that contrast.  </p>
<p>Examples of colors that will make a bad contrast are gray and white, brown and orange, red and purple, and so on.</p>
<p>Here is an example that shows good color contrast that's easy to read:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Image illustrating good contrast using a dark blue background with white text</em></p>
<p>And here's an image with poor color contrast that's hard to read:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Image Illustrating bad contrast using a white background with light grey text</em></p>
<p>Also, it's a good idea to include descriptive alternative text (alt text) for images, explaining what they depict and their purpose.</p>
<p>So for example, when you want to add an image to your website, you can add alt text to it explaining what it depicts. </p>
<p>Here is a markup description of how to add alt text to an image:</p>
<pre><code class="lang-HTML">    <span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"Dog.png"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">"Image of a dog"</span>&gt;</span>
</code></pre>
<p>Here is an example that shows an image of two (2) dogs:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/dog.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Image of two dogs</em></p>
<p>And here's an example of an image that illustrates the use of alt text:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/dog1-1.jpg" alt="Image" width="600" height="400" loading="lazy">
<em>Image of dog with alt text displayed</em></p>
<p>You should also describe your icon buttons.</p>
<p>Icons can be easily understood most of the time. It's widely recognized that an x symbol, like this ❌, typically closes a window, a check mark ✅ signifies completion, a forward arrow ▶ signifies send (or play), and a plus sign ➕ represents addition. </p>
<p>But this is clear only for individuals with visual capabilities. For people who aren't able to see the buttons, you'll need to provide a description so they know what that button does.</p>
<p>Let's take a look at this HTML and CSS code that shows how to make buttons access:</p>
<p>&lt;!DOCTYPE html&gt;</p>


    
    
    
    Document




    <i> Delete </i>
    <i> Check </i>
    <i> Send</i>
    <i> Add</i>



<p>Here's the result of the code implemented above:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/code1.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-is-it-operable">Is it Operable?</h3>
<p>Users should be able to navigate and interact with the interface quickly. Consider the following factors:</p>
<p>First, make sure you use clear and consistent headings.</p>
<p>This is what clear and consistent headings look like:</p>
<h1 id="heading-i-am-a-title">I am a Title</h1>
<h2 id="heading-i-am-a-subtitle">I am a Subtitle</h2>
<h3 id="heading-this-is-heading-3">This is heading 3</h3>
<h4 id="heading-this-is-heading-4">This is Heading 4</h4>
<h5 id="heading-this-is-heading-5">This is Heading 5</h5>
<h6 id="heading-this-is-heading-6">This is heading 6</h6>
<p>As you can see, these headings go from largest to smallest in order. We have an H1 heading first, followed by H2, H3, and so on.</p>
<p>Here are some headings that don't follow the proper hierarchy: </p>
<h6 id="heading-this-is-heading-6-1">This is heading 6</h6>
<h5 id="heading-this-is-heading-5-1">This is Heading 5</h5>
<h4 id="heading-this-is-heading-4-1">This is Heading 4</h4>
<h3 id="heading-this-is-heading-3-1">This is heading 3</h3>
<h2 id="heading-i-am-a-subtitle-1">I am a Subtitle</h2>
<h1 id="heading-i-am-a-title-1">I am a Title</h1>
<p>In this example, the headings go in reverse order, starting from H6 and moving up through H5, H4, and so on. </p>
<p>Just remember to use proper heading hierarchy – don't use an H2 and then jump straight to H4 for a subheading, for example, as this is visually jarring and doesn't convey the proper importance or hierarchy of the text.</p>
<p>Here's why heading hierarchy is important:</p>
<ul>
<li>A clear heading hierarchy helps readers easily navigate and understand the content of a document.</li>
<li>Heading hierarchy is crucial for accessibility, as it helps screen readers and assistive technologies interpret the structure of the content. This is important for individuals with visual impairments who rely on such tools to access information.</li>
<li>A well-organized heading hierarchy implement a logical flow of information, ensuring that topics are presented in a coherent order.</li>
</ul>
<p>Also, refrain from using elements that might trigger physical discomfort, like bright flashing lights.</p>
<p>And make sure you think about <a target="_blank" href="https://www.freecodecamp.org/news/designing-keyboard-accessibility-for-complex-react-experiences/">keyboard accessibility</a> so users can navigate and communicate using the keyboard, and not exclusively using a mouse.</p>
<h3 id="heading-is-it-understandable">Is it Understandable?</h3>
<p>Content and functionality should be presented clearly and understandably. Consider the following factors:</p>
<ul>
<li>Organize content using headings, subheadings, and bullet points to enhance readability.</li>
<li>Provide instructions and error messages that are easy to understand.</li>
<li>Use simple and concise language, avoid complex terms.</li>
</ul>
<h3 id="heading-is-it-robust">Is it Robust?</h3>
<p>Websites should be built using robust and widely supported technologies to enable compatibility across devices and assistive technologies. </p>
<p>You'll want to maximize compatibility with current and future user agents, including assistive technologies.</p>
<p>Here are some of the ways you can maximize compatibility with current and future agents, including assistive tools:</p>
<ul>
<li>Use <a target="_blank" href="https://www.freecodecamp.org/news/semantic-html-alternatives-to-using-divs/">HTML5 semantic elements</a> like <code>&lt;header&gt;</code>, <code>&lt;nav&gt;</code>, <code>&lt;main&gt;</code>, and <code>&lt;footer&gt;</code> to enhance the document's structure.</li>
<li>Ensure that your <a target="_blank" href="https://www.freecodecamp.org/news/javascript-performance-async-defer/">JavaScript code is efficient</a> and doesn't block the rendering process.</li>
<li>Utilize <a target="_blank" href="https://www.freecodecamp.org/news/learn-how-to-use-the-chrome-devtools-to-troubleshoot-websites/">browser developer tools</a> and online testing services to identify and fix compatibility issues.</li>
<li>Conduct <a target="_blank" href="https://www.freecodecamp.org/news/10-best-ux-testing-software-tools/">usability testing</a> with a diverse group of users, including those who rely on assistive technologies, to gather feedback and make improvements.</li>
<li>Optimize your website for fast loading times and low data usage using techniques like <a target="_blank" href="https://www.freecodecamp.org/news/a-detailed-guide-to-pre-caching/">caching</a> and <a target="_blank" href="https://www.freecodecamp.org/news/cdns-speed-up-performance-by-reducing-latency/">tools like CDNs</a> to reduce latency. This benefits both accessibility and user experience.</li>
<li>Document your code and accessibility features for future maintainers.</li>
<li>Test <a target="_blank" href="https://www.freecodecamp.org/news/cross-browser-compatibility-testing-best-practices-for-web-developers/">website compatibility across various browsers</a>. Testing website compatibility involves ensuring that your website functions correctly and looks good on a variety of devices, browsers, and assistive technologies. </li>
</ul>
<p>Here are the steps you can follow to test website compatibility effectively:</p>
<ol>
<li><strong>Device Testing</strong>: Test your website on various devices, such as desktop computers, laptops, tablets, and smartphones. This includes both iOS and Android devices.</li>
<li><strong>Browser Testing</strong>: Check your website's performance and appearance on multiple browsers, including but not limited to Google Chrome, Mozilla Firefox, Apple Safari, and  Microsoft Edge.</li>
<li><strong>User Testing</strong>: Conduct usability testing with real users. Ask them to use your website on different devices and browsers and collect feedback on compatibility issues.</li>
<li><strong>Performance Testing</strong>: Assess website loading times, and optimize for speed using tools like Google PageSpeed Insights, GTmetrix, or Lighthouse. Check for compatibility with slow internet connections.</li>
</ol>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Understanding web accessibility can enhance the user experience by creating a smooth and seamless interaction with websites and web applications.</p>
<p>Implementing these tips can improve the overall user-friendliness and navigability of your app. It'll help create a more enjoyable experience for all users, and will also allow people with disabilities to perceive, understand, navigate, and interact with your sites effectively.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
