Marius Mario

Greenhorn
+ Follow
since Mar 07, 2021
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
8
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Marius Mario

Not sure why is this worse, as I tried to explain what I learnt from this specific example, I thought this is a place where the newbies will get help from the most experienced users, but I think I was wrong.
I just tried to understand some basic things as I did not get it from Janne and Scott Selikoff book.
If I wrote something wrong I would like to see the correct version of it, as English is not my first language.
Thanks anyway.
Thanks Myklos,

I did research and I found this "If we have a for loop inside another loop, the inner loop executes completely whenever outer loop executes."
Based on this I rebuild the flow for this nested flow and got this:

-1st iteration: a=1 , condition met as 1<= 4, so is true, flow go to next "for" loop:  x=a, x<=c, true, print 1a; x++ that is x=b;
                                                                                          x = b;x <=c, true, but x==b will activate the continue statement as the if statement will return true, which will transfer the control to boolean expression for inner loop than nothing to print and x
                                                                                          will be x++ that is x=c;
                                                                                          x = c ; x<=c, true, print 1c, x++ is d
                                                                                          x=d; x<=c is false, end of iteration;
a = a+1= 2 ( end of first iteration)
-2nd iteration: a=2, a<=4, true, x=a, x<=c, true, but a=2  will activate the continue statement as the if statement will return true, which will transfer the control to boolean expression for inner loop, nothing to print,  and whole inner loop will not be printed as ||(OR short circuit operator)  operator will be evaluated true no matter what will be the  x value;
a will became a++ , that is a=3 ( end of second iteration);
- 3rd iteration: a=3, a<=4 is true, next "for"loop, x=a, x<=c, true, print 3a; x++ that is x=b;
                                                                        x=b, x <=c, true, but x==b will activate the continue statement as the if statement will return true, which will transfer the control to boolean expression for inner loop, nothing to print,  and x will be x++ that
                                                                        is x=c;
                                                                        x = c ; x<=c, true, print 3c,x++ is d
                                                                        x=d; x<=c is false, end of iteration;
a = a+1= 4 ( end of third iteration);
- 4th iteration: a=4, a<=4 is true, next "for"loop, x=a, x<=c, true, print 4a; x++ that is x=b;
                                                                        x=b, x <=c, true, but x==b will activate the continue statement, which will transfer the control to boolean expression for inner loop, nothing to print,  and x will be x++ that is x=c;
                                                                        x = c ; x<=c, true, print 4c, x++ is d
                                                                        x=d; x<=c is false, end of iteration;
a++ that is a=5 (end of 4th iteration);
- 5th iteration: a=5, a<=4, false, loop skipt (end).


The main point I took from here is this "the inner loop executes completely whenever outer loop executes." Now here the completely part will not apply as the if statement will stop the flow on certain conditions.Love Java ..pffff Lol
Not sure if my logic flow is right here, I think so, but hopefully this will help other novices like me to get the basics right.
All the best!

                                                                                         
                                                                                         
                                                                                                                             
Hi guys,
Need a little help with these nested loops, please: ( pg 91, OCA SE 8 J B and SS)



I don't get how is the output 1a 1c 3a 3c 4a 4c, the continue will transfer the control to inner for loop ( the char one)  when a is 2  but how we get the 1c output.

The nested loops flow is a big issue for me at the moment.
Thanks in advance.
Marius
Hi everyone,
Just come across the subroutines processors mechanism using CALL and RETURN instructions.
My problem is that I don't understand this stacking process when this will apply to nested subroutines,
what will be the return address of a subroutine when the CALL instruction will be executed?
what is the logic chain between CALL and RETURN here?. Any help will be much appreciated.
Thank you.
Marius
1 year ago