Why does java print 0 as the first item and THEN increment num, and not print the incremented num; 1? Please and thank you.
Java logic
because youre using postorder notation
you're looking for ++n
it isn't just java this is standard
every language with post-increment does that retard.
cheers
Let's take a moment to think about the fact that OP is already more knowledgeable than 60% of Sup Forums
how do you get those boxes?
Why do you use BlueJ?
Isn't show() deprecated?
Probably goes to UTS
It's BlueJ
I used blueJ in my australian uni.
It was fucking awful, and broke my program. Running it from the command line worked, but blueJ would not.
Also, why have this ugly code-block-box feature, when enforcing the
function ()
{
}
convention would do the same thing?
num++
> print the base case variable == 0
> Increase increments as suggested
Wait until you have used DrJava.
That shit was used at RMIT and it was a cunt to format code with. Never enjoyed running sources from other hard drives either.
>mfw there are people on Sup Forums going to the same uni as me
What Uni mate?
I heard that RMIT is actually trash for CS, despite reputation. What do you reckon?
UKC
Isn't this beginner stuff tho? why are you only doing this? I started in October and I'm already on recursion
You guys are retarded if you don't know the difference between num++ and ++num
you're replying to a bunch of 17/18 year olds in first year uni
This is why imperative languages are shit, order of evaluation makes no sense.
it's his own method who gives a fuck
This is not a property of imperative languages in general. This is just a property of C-likes, which have the pre-order/post-order increment operators. And incidentally, it is not a problem. If you are doing something like y = x++, you are more likely trying to code golf, than produce something that is easy to understand at a glance. In this case, you should know how pre-order vs post-order increment operators work.
Incidentally, if you are trying to complain about languages that use infix notation, which is a bit different from the class of programs that are imperative, order of operations is mostly based on what one might expect in mathematics.