---
title: "Discussion on \"Go Basics: For loop suprise!\" | Hashnode"
description: "Discussion on \"Go Basics: For loop suprise!\". What happens when we run this code?\nfunc main() {\n    data := []string{\"Hello\", \"World\"}\n\n    toPrint := []*string{}\n    for _, a := range data {\n        toPrint = append(toPrint, &a)\n    }\n\n    for _, p := range toPrint {\n        fmt.Println(*p)\n   ..."
url: "https://hashnode.com/posts/go-basics-for-loop-suprise/61926081fd3a1a5a01a88a17"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Go Basics: For loop suprise!](https://www.jimmiebtlr.com/go-basics-for-loop-suprise?utm_source=hashnode&utm_medium=feed)

What happens when we run this code? func main() { data := \[\]string{"Hello", "World"} toPrint := \[\]\*string{} for \_, a := range data { toPrint = append(toPrint, &a) } for \_, p := range toPrint { fmt.Println(\*p) ...

Nov 15, 2021 · 2 min read · jimmiebtlr.com  
Read the article

-   [#go](https://hashnode.com/tag/go)
-   [#development](https://hashnode.com/tag/development)
-   [#dev](https://hashnode.com/tag/dev)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)

## Written by

[Jimmie Butler](https://hashnode.com/@jimmie)

@jimmie · Lisbon,Portugal

  
[View profile](https://hashnode.com/@jimmie)

Freelance Developer

I'm a freelance full stack developer with 10 years experience. Generative design with machine learning is something I'm interested in and researching in my free time.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
