[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Java logic

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 23
Thread images: 2

File: Help.png (5KB, 298x188px) Image search: [Google]
Help.png
5KB, 298x188px
Why does java print 0 as the first item and THEN increment num, and not print the incremented num; 1? Please and thank you.
>>
>>60061705
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.
>>
>>60061714
cheers
>>
Let's take a moment to think about the fact that OP is already more knowledgeable than 60% of /g/
>>
>>60061705
how do you get those boxes?
>>
>>60061705
Why do you use BlueJ?
>>
>>60061705
Isn't show() deprecated?
>>
>>60062130
Probably goes to UTS
>>
>>60062104
It's BlueJ
>>
>>60062462
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?
>>
>>60061714
num++
> print the base case variable == 0
> Increase increments as suggested
>>
>>60062700
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.
>>
File: 7678t.jpg (31KB, 635x600px) Image search: [Google]
7678t.jpg
31KB, 635x600px
>>60061705
>mfw there are people on /g/ going to the same uni as me
>>
>>60062765
What Uni mate?
>>
>>60062738
I heard that RMIT is actually trash for CS, despite reputation. What do you reckon?
>>
>>60062788
UKC
>>
>>60062765
Isn't this beginner stuff tho? why are you only doing this? I started in October and I'm already on recursion
>>
>>60062765
You guys are retarded if you don't know the difference between num++ and ++num
>>
>>60065848
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.
>>
>>60062191
it's his own method who gives a fuck
>>
>>60067843

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.
Thread posts: 23
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.