We've written this code:
void mainFunction() {
System.out.println("My name is Andy");
System.out.println("I code in Python");
System.out.println("I have a dog");
System.out.println("My name is Mike");
System.out.println("I code in Java");
System.out.println("I have a cat");
System.out.println("My name is Sarah");
System.out.println("I code in JavaScript");
System.out.println("I have a parrot");
}
Write the same code in a better way by creating and calling a function with parameters printMessages()
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
