An interactive introduction to Go in three sections. The first section covers basic syntax and data structures; the second discusses methods and interfaces; and the third introduces Go's concurrency primitives. Each section concludes with a few exercises so you can practice what you've learned. You can take the tour online or install it locally with:

$ go install golang.org/x/website/tour@latest
An interactive introduction to Go in three sections. The first section covers basic syntax and data structures; the second discusses methods and interfaces; and the third introduces Go's concurrency primitives. Each section concludes with a few exercises so you can practice what you've learned. You can take the tour online or install it locally with:

$ go install golang.org/x/website/tour@latest
C#'s type system is unified such that a value of any type can be treated as an object. Every type in C# directly or indirectly derives from the object class type, and object is the ultimate base class of all types. Values of reference types are treated as objects simply by viewing the values as type object. Values of value types are treated as objects by performing boxing and unboxing operations. In the following example, an int value is converted to object and back again to int.

int i = 123;
object o = i;    // Boxing
int j = (int)o;  // Unboxing
As a small example, consider an assembly that contains the following code:

namespace Acme.Collections;

public class Stack<T>
{
    Entry _top;

    public void Push(T data)
    {
        _top = new Entry(_top, data);
    }

    public T Pop()
    {
        if (_top == null)
        {
            throw new InvalidOperationException();
        }
        T result = _top.Data;
        _top = _top.Next;

        return result;
    }

    class Entry
    {
        public Entry Next { get; set; }
        public T Data { get; set; }

        public Entry(Entry next, T data)
        {
            Next = next;
            Data = data;
        }
    }
}
Because an assembly is a self-describing unit of functionality containing both code and metadata, there's no need for #include directives and header files in C#. The public types and members contained in a particular assembly are made available in a C# program simply by referencing that assembly when compiling the program. For example, this program uses the Acme.Collections.Stack class from the acme.dll assembly:

class Example
{
    public static void Main()
    {
        var s = new Acme.Collections.Stack<int>();
        s.Push(1); // stack contains 1
        s.Push(10); // stack contains 1, 10
        s.Push(100); // stack contains 1, 10, 100
        Console.WriteLine(s.Pop()); // stack contains 1, 10
        Console.WriteLine(s.Pop()); // stack contains 1
        Console.WriteLine(s.Pop()); // stack is empty
    }
}
Now that you have an idea of how to create basic SVG files, the next stage is to upload them to a Webserver. There are some gotchas at this stage though. For normal SVG files, servers should send the HTTP headers:

Content-Type: image/svg+xml
Vary: Accept-Encoding
The "Hello, World" program is traditionally used to introduce a programming language. Here it is in C#:

using System;

class Hello
{
    static void Main()
    {
        Console.WriteLine("Hello, World");
    }
}
Let us dive straight in with a simple example. Take a look at the following code.

<svg version="1.1"
     width="300" height="200"
     xmlns="http://www.w3.org/2000/svg">

  <rect width="100%" height="100%" fill="red" />

  <circle cx="150" cy="100" r="80" fill="green" />

  <text x="150" y="125" font-size="60" text-anchor="middle" fill="white">SVG</text>

</svg>
You can also extract a substring or split a string into a list of substrings:

// Grab a substring.
assert('Never odd or even'.substring(6, 9) == 'odd');

// Split a string using a string pattern.
var parts = 'progressive web apps'.split(' ');
assert(parts.length == 3);
assert(parts[0] == 'progressive');

// Get a UTF-16 code unit (as a string) by index.
assert('Never odd or even'[0] == 'N');

// Use split() with an empty string parameter to get
// a list of all characters (as Strings); good for
// iterating.
for (final char in 'hello'.split('')) {
  print(char);
}

// Get all the UTF-16 code units in the string.
var codeUnitList = 'Never odd or even'.codeUnits.toList();
assert(codeUnitList[0] == 78);
The go run command is one of many go commands you'll use to get things done with Go. Use the following command to get a list of the others:

$ go help
Attach the newly created element to the document by assigning a parent to the element. You can add an element to any existing element’s children. In the following example, body is an element, and its child elements are accessible (as a List) from the children property.

document.body!.children.add(elem2);

Recommend

Go 1.13 Release Notes Tools godoc and go doc

Go 1.13 Release Notes Tools Modules Version validation

Go 1.13 Release Notes Tools Modules Environment variables

Go 1 Release Notes Minor changes to the library The url package

Go 1 Release Notes Minor changes to the library The testing package

Go 1 Release Notes Minor changes to the library The path/filepath package

Go 1 Release Notes Minor changes to the library The os/signal package

Go 1 Release Notes Minor changes to the library The os package The os.FileInfo type

Go 1 Release Notes Minor changes to the library The go/* packages

Go 1 Release Notes Minor changes to the library The flag package

Go 1 Release Notes Major changes to the library Time

Go 1 Release Notes Major changes to the library The error type and errors package

Go 1 Release Notes Changes to the language Equality

Go 1 Release Notes Changes to the language Copying structs with unexported fields

Go 1 Release Notes Changes to the language Returns and shadowed variables

Go 1 Release Notes Changes to the language Multiple assignment

Go 1 Release Notes Changes to the language Iterating in maps

Go 1 Release Notes Changes to the language Deleting from maps

Go 1 Release Notes Changes to the language The error type

Go 1 Release Notes Changes to the language The rune type

Go 1 Release Notes Changes to the language Goroutines during init

Go 1 Release Notes Changes to the language Composite literals

Go 1 Release Notes Changes to the language Close

Go 1 Release Notes Changes to the language Append

Go 1.6 Release Notes Core library Templates

Go 1.6 Release Notes Core library Reflect

Go 1.6 Release Notes Tools Compiler Toolchain

Go Fuzzing Corpus file format

Go Fuzzing Running fuzz tests Custom settings

Go Fuzzing Running fuzz tests Failing input

Go Fuzzing Running fuzz tests Command line output

A Quick Guide to Go's Assembler Architecture-specific details Unsupported opcodes

A Quick Guide to Go's Assembler Architecture-specific details 64-bit Intel 386 (a.k.a. amd64)

A Quick Guide to Go's Assembler Architecture-specific details 32-bit Intel 386

A Quick Guide to Go's Assembler Architecture-specific details

A Quick Guide to Go's Assembler A Quick Guide to Go's Assembler Interacting with Go types and constants

A Quick Guide to Go's Assembler A Quick Guide to Go's Assembler Directives

A Quick Guide to Go's Assembler A Quick Guide to Go's Assembler Symbols

A Quick Guide to Go's Assembler A Quick Guide to Go's Assembler

Managing Go installations Uninstalling Go Windows

Managing Go installations Installing multiple Go versions

Go 1.10 Release Notes Core library Minor changes to the library

Go 1.10 Release Notes Tools Doc

Go 1.10 Release Notes Tools Cgo

Go 1.1 Release Notes Changes to the standard library Exp and old subtrees moved to go.exp and go.text subrepositories

Go 1.1 Release Notes Changes to the standard library bufio.Scanner

Go 1.1 Release Notes Changes to the implementations and tools Build constraints

Go 1.1 Release Notes Changes to the implementations and tools Changes to the go test command

Go 1.1 Release Notes Changes to the implementations and tools Changes to the go command

Go 1.1 Release Notes Changes to the implementations and tools Unicode

Go 1.1 Release Notes Changes to the implementations and tools Size of int on 64-bit platforms

Go 1.1 Release Notes Changes to the language Method values

Go 1.1 Release Notes Changes to the language Integer division by zero

Go 1.8 Release Notes Changes to the language

Go 1.2 Release Notes Changes to the standard library The text/template and html/template packages

Go 1.2 Release Notes Changes to the standard library The fmt package

Go 1.2 Release Notes Changes to the implementations and tools The go doc command is deleted

Go 1.2 Release Notes Changes to the implementations and tools Test coverage

Go 1.2 Release Notes Changes to the implementations and tools Godoc and vet moved to the go.tools subrepository

Go 1.2 Release Notes Changes to the language Three-index slices