Example of initializing an array of strings in Go

This Go example program illustrates how to initialize an array of strings.

package main

import (

// Using var

var validTags = []string{

func main() {

        // Using :=

        stringarray := []string{
        for _, s := range (stringarray) {
                fmt.Println (s)


Copyright © Ben Bullock 2009-2021. All rights reserved. For comments, questions, and corrections, please email Ben Bullock (benkasminbullock@gmail.com) or use the discussion group at Google Groups. News about the site. / Privacy / Disclaimer