0
Can I write "return(a*b)" istead of just "return a*b". It's so confusing now not to have parentheses.. Will it make difference?
2 Respostas
+ 3
Theres no difference between them in your example, parenthesis are used to order the way you want your code to operate.
here we have 2 sums which are the same they both follow precedence but in last one I control the order using parenthesis which has a higher precedence over multiplication operator.
(2*2+4*2) //output 12
2*2 = 4;
4*2 = 8;
4+8 = 12;
(2*(2+4)*2) //output 24
2+4 = 6:
2*6 = 12;
12*2 = 24;
0
Yes you can but make sure that there is a space after the return statement