age with an integer valueisMember with a boolean valueif statements to check age and isMemberage with an integer valueisMember with a boolean valueif statements to check age and isMemberage and set it to 20. Create a variable called isMember and set it to true.Use var to declare variables with their types and assign the exact values.
ticketPrice and set it to 15.Use var ticketPrice int = 15 to set the starting price.
if statements to check if age is less than 18. Inside that, check if isMember is true. If both are true, set ticketPrice to 5. Otherwise, if age is 18 or more and isMember is true, set ticketPrice to 10.Use nested if inside another if and an else block to check conditions step by step.
fmt.Println statement to print the text "Ticket price: " followed by the value of ticketPrice.Use fmt.Println("Ticket price:", ticketPrice) to show the final price.
What does a nested conditional statement in Go allow you to do?
Example: if x > 0 { if x < 10 { ... } }
Which of the following is the correct syntax for a nested if statement in Go?
if x > 0 {
if x < 10 {
fmt.Println("x is between 1 and 9")
}
}What will be the output of this Go code?
package main
import "fmt"
func main() {
x := 7
if x > 5 {
if x < 10 {
fmt.Println("A")
} else {
fmt.Println("B")
}
} else {
fmt.Println("C")
}
}Find the error in this Go code snippet:
package main
import "fmt"
func main() {
x := 3
if x > 0
if x < 5 {
fmt.Println("x is between 1 and 4")
}
}Write a nested conditional in Go that prints "Small positive" if a number n is greater than 0 and less than 10, prints "Large positive" if it is 10 or more, and prints "Non-positive" otherwise. What is the correct code?
Pass the test and this pattern moves unknown