Sign in

niya‎

@niya.blue
165 followers 281 following 149 posts

🏳️‍⚧️ she/her prev: Developer at MagicBell (YC W21)

PostsRepliesMedia
niya‎ @niya.blue · 23/05/2025
TIL: pre-Go 1.22, closures inside for loops would share the same value for a variable. this would output `3, 3, 3`
Screenshot of Go code:
    var prints []func()
    
    for i := 1; i <= 3; i++ {
        prints = append(prints, func() { fmt.Println(i) })
    }
    
    for _, print := range prints {
        print()
    }
230
niya‎ @niya.blue · 28/04/2025
explanation: it’s easy to make mistakes because of integer overflows. this is the reason why len returns a signed integer, if it were a unint, in the code snippet below, the value of i will always remain positive because i will overflow. example from The Go Programming Language book :)
A code snippet screenshot with the code:

medals := []string{"gold", "silver", "bronze"}

for i := len(medals) - 1; i >= 0; i-- {
    fmt.Println(medals[i])
}

the medals[i] will go out of bounds if the length were a unsigned int
000
niya‎ @niya.blue · 28/04/2025
meet Freya, she’s a pet of a friend of mine 💙
freya (cat) on top of a refrigerator freya (cat) lying on the floor
093
niya‎ @niya.blue · 18/11/2024
Go functions can take type as a parameter and return it... I wonder what other ways types as values can be useful in Go 👀
code screenshot:

// func make(t Type, size ...int) Type
make(map[string]int)
110
niya‎ @niya.blue · 10/11/2024
here's a cat i clicked last month
cat
281
niya‎ @niya.blue · 09/11/2024
oh no
ChatGPT made an image with AWS and Go written everywhere in my room
030
niya‎ @niya.blue · 08/11/2024
🤦🏽‍♀️ that’s the state i live in source: www.hindustantimes.com/india-news/n...
000
niya‎ @niya.blue · 05/11/2024
did you move today anon? 💪🏼
My workout stats

Active Calories Burnt: 872
Total Calories Burnt: 2,509

Exercise: 73 minutes

Stand: 11/10 hoursMore stats showing I walked 15k steps or 9.63KM
000
niya‎ @niya.blue · 03/11/2024
i love blusky as well!
010
niya‎ @niya.blue · 03/11/2024
;-;
110
niya‎ @niya.blue · 31/10/2024
neat! it redirects to google translation and also tells me if I am writing a post in the wrong language
000
niya‎ @niya.blue · 05/07/2023
uncool. threads haven't launched yet though, let's wait 20 mins and try again
Threads' app saying my account does not meet the requirements to use threads.
100
niya‎ @niya.blue · 05/07/2023
instagram branding, it's not black and white after all but I would have loved a new branding my dopamines are craving novelty
Threads's Splash Screen on iOS
100