Only Return wouldn’t be the same?
Not!!!
The $idade--
subtract 1
of the value of $idade
. Amounts to:
$idade = $idade - 1;
Therefore, if you withdraw the $idade--
, the value returned by its function will always be 1
more than she returns today.
If you want, you can even do both things on the same line, but then you’d need to use --$idade
instead of $idade--
:
return --$idade;
That’s because the --
at the end first returns the (current) value of the variable, and then decrees. At the beginning it first decrees and then returns. The same is true for increment operators ++
(at the beginning or at the end).
$idade = $idade -1
, without them
, nay?– Caio Felipe Pereira
@Caiofelipepereira Ops, thanks, I hadn’t seen.
– bfavaretto
Dispose. That’s what we’re there for
– Caio Felipe Pereira
I get the job now, Thank
– Lucas C.S
Every year it adds up +1, $age-- makes it -1 if the month has not passed and etc.
– Lucas C.S