+ 1
What is the difference between void and int
3 Respostas
0
int is a number that has no decimal eg -11 or 167. void is a return type eg private void PrintGreeting(){print(“hello world”)}
in this example you dont need to return anything so you put void. if you wanted to use int insead that would mean you need to return an int eg
private int AddNumbers(){return 1+2}
0
Int returns a whole number
Void returns nothing (for example when you want to print something