greptilian logo

IRC log for #friendlyjava, 2021-05-24

##friendlyjava on freenode

| Channels | #friendlyjava index | Today | | Search | Google Search | Plain-Text | plain, newest first | summary

All times shown according to UTC.

Time S Nick Message
03:46 mr_lou joined ##friendlyjava
03:57 mr_lou The "arrow operator", as I understands it, substracts first and then asks. Which means then I understand why it should be n-->=0 rather than n-->0
03:58 mr_lou Because I want 0 included.
05:12 mr_lou I've always understood a for loop as being kinda the same as a while loop.
05:12 mr_lou for (int n=10;n>0;n--)
05:12 mr_lou was the same as
05:13 mr_lou int n=10; while(n>0) {n--;}
05:13 mr_lou But apparently not.
05:14 mr_lou ...unless ofcourse the "n--" part is placed after the code....
05:14 mr_lou for (int n=10;n>0; <code executed> ; n--)
05:15 mr_lou int n=10; while(n>0) {<code executed>; n--}
05:27 mr_lou Oh right, that's what you said.
10:22 aditsu mr_lou: no, it asks first and then subtracts
10:22 aditsu if it was --n>0 then it would subtract first
11:53 mr_lou Aaah
11:57 mr_lou So...  for ( n=0; n<10; n++) goes from 0 to 9
11:57 mr_lou for ( n=0; n++<10;) goes from 1 to 10
11:57 mr_lou for ( n=0; ++n<10;) gose from 1 to 9
11:57 mr_lou Does that sound right?
13:03 aditsu yes
21:18 aditsu joined ##friendlyjava

| Channels | #friendlyjava index | Today | | Search | Google Search | Plain-Text | plain, newest first | summary

##friendlyjava on freenode