Shadowed variables

Report a typo

Below you will see a small Go program that has a shadowed variable burgerCombo. Please select one line of code that needs changing or removing, so that the program can print the correct amount of food in a burger combo: 🍔🍟🥤 and not just one burger: 🍔. Answer with the number of the line you choose.

package main
        
import "fmt"

func main() {
    burgerCombo := "🍔"       // 1

    if true {
        burgerCombo := "🍔"   // 2
        burgerCombo += "🍟🥤" // 3
    }
    
    fmt.Println(burgerCombo)   // 4
}
Select one option from the list
___

Create a free account to access the full topic