Thursday, November 15, 2012

Answers > How Do I Output Xhtml Text for an Infinite Loop?

How Do I Output Xhtml Text for an Infinite Loop?

by nForms on May 30, 2012

I'm a student learning javascript, I'm having a very basic problem. I have to write a script that outputs XHTML text that keeps displaying in the browser window that multiples of the integer 2. How do i get it to display on the screen?

Tags: , , ,

Similar XForms | XML Posts

{ 1 comment… read it below or add one }

Paul August 18, 2011 at 9:35 pm

Just write a method with infinite recursion, but which multiplies by, and then increments an external variable.

wow, that’s actually so not helpful..sorry, whenever I learn anything, especially computer stuff, it always irritates me loads when people explain things ( such as an infinite loop ) in terms of other words and concepts I clearly don’t know about ( such as infinite recursion ). Yet I STILL catch myself doing it all the time. =/
I mean, if you knew what infinite recursion was, you wouldn’t ask this question! =P

let me give you a less concept heavy explanation.

int multiple;
multiple = 1;

function stuff {
// insert other stuff function is supposed to do

2*multiple; // multiplies by the next multiple in the list

multiple ++;
// or, if they’re Specific multiples of the integer 2 you’re supposed to output, make an algorithm(
// eg. multiple = multiple +2; gives you every second one

stuff () // this is what causes the recursion. the method calls itself so the loop never breaks or ends
}

Previous post:

Next post: