+ 1

What is the difference between void and int

19th May 2019, 4:15 AM
J. Sanjay
J. Sanjay - avatar
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}
19th May 2019, 4:26 AM
JJ Auer
JJ Auer - avatar
0
Int returns a whole number Void returns nothing (for example when you want to print something
19th May 2019, 4:28 AM
Hothouseinwar Polik
Hothouseinwar Polik - avatar