Senior
18 novembre 2026

Trova il bug: Go

Uno snippet di codice. Trova il bug, o dimostra che non ce n'è.

go
1package main
2
3import "fmt"
4
5func printItems(items []string) {
6	if items == nil || len(items) == 0 {
7		fmt.Println("empty")
8		return
9	}
10	for _, item := range items {
11		fmt.Println(item)
12	}
13}
14
15func main() {
16	printItems(nil)
17	printItems([]string{"a", "b"})
18}

Clicca sulle righe che causano il problema.

Il tuo verdetto

Un tentativo al giorno. La risposta appare subito dopo.

Mantieni la tua serie

Crea un account per conservare la tua serie e seguire i tuoi progressi.

Crea un account