I was wondering if anyone could help me with a question i have regarding an IJVM program i am working on. I think it is a very simple solution for anyone who knows the language well. I didn't know where to post my question, so i posted here.
I'm trying to add every number up to a number entered. (So, if you entered 5, it would add 0+1+2+3+4+5)
I can keep adding "IADD" and it will add as many numbers together as i have "IADD"s. But, i need to implement a loop, so it will keep adding the numbers until the bottom of the stack. But i can't figure out how to do this.
Here is how i am doing it without a loop. This will be 0+1+2+3+4 and will return 10. Since i don't know what number is going to be entered, i need to turn it into a loop.
So it would be something like:
I can't figure out how to make the loop in this language.
geta6: if no more numbers to be added (at the bottom number of the stack)
Any help would be appreciated.
Nevermind, i figured it out.