Using Go, I am trying to send values from main to the function. I want to check if any parameter sent to function is empty. If there is any missing values, I want to print that the "Parameter value" is empty. If there are multiple parameters empty, I want to print that as well. If all parameters are correctly given, return the value.
func FederationValidarator(a string, b string) (string, string) {
// var Messages []string
rArray := [2]string{a, b}
// i :=0
for i := 0; i < len(rArray); i++ {
if rArray[i] != "" {
fmt.Println("Nothing is empty")
} else {
// var Messages []string
fmt.Println("%s is Missing")
}
}
return a, b
}
func main() {
a, b := FederationValidarator("", "world")
fmt.Println(a)
fmt.Println(b)
}
How can i code to print missing values? I want to get the following output.
The results:
%s is Missing
Nothing is empty
world
Expected Output:
a is Missing
world
question from:https://stackoverflow.com/questions/65623325/print-missing-values