Hey all,

Im working with assembly atm and thought i might just get a better idea understanding loops if i know how java loops work not that it is really the same im just trying to back track.

Im trying todo the following:

When var1 = 3

It then needs to loop in colom and row format something like this:

333
333
333

I have tryed setting up counters and i can do the 1st column that is no problem but when i try do more then all hell breaks loose lol.

So yeah i just really needa c how a loop runs with the number entered.

Any help at all would be much appreciated.

I don't understand the question... but is this what you were looking for?

for (int i = 0; i<var1; i++) {
  for (int j = 0; j<var1; j++) {
    System.out.print(var1);
  } 
  System.out.print("\n");
}

giving:
333
333
333
or, for var1 = 2,
22
22

If you program in assembler, knowledge of a high-level/middle-level programming language is already assumed before you even start learning assembly, and you don't know how a simple loop works in Java? :P
If your question is how to do this in assembly, you should have posted/started this thread in the assembly forum :)

BTW, Which loop are you talking about? In Java you've more than one loop: for, while, do-while ; examples:

/* This loop executes if condition is (evaluated to) true*/
while(condition) {
    // your code here
}
/* This loop will run at least one time, and executes as long as expression is evaluated to true */
do {
    // your code here
} while(expression);
/* This loop will run 10 times */
for(i=0; i<=10; i++) {
    // your code here
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.