If statement issues

I’m not sure how to go about this in this existing code. At the end you’ll see 6 words will display, and if there is more than 6 then any more words go on another line. So as to not have it look strange if there are 7 words (6 on first line and 1 under it) is it possible to have the code split the words like 4 on top, 3 on bottom. Maybe something like “if more than 6 words, line break after 4 words instead” or something like that?


if (lettercount == 0) {
	i = 1;
	usedwords[nameindexednmbr*]++;
	if (usedwords[nameindexednmbr*]>3) {
		usedwords[nameindexednmbr*] = 1;
	}
	wordfadeadj.adjwords = adjective[babygender][nameindexednmbr*][usedwords[nameindexednmbr*]];
} else {
	for (i=1; i<lettercount+2; i++) {
		usedwords[nameindexednmbr*]++;
		if (usedwords[nameindexednmbr*]>3) {
			usedwords[nameindexednmbr*] = 1;
		}
		///start of my fix
		//this doesn't even trace out
		if ([usedwords[nameindexednmbr*]] == lettercount+1){
			trace("this is the last word");
		}
		trace([usedwords[nameindexednmbr*]]);
		trace(lettercount+1);
		/////////end of my fix
		wordfadeadj.adjwords = wordfadeadj.adjwords+adjective[babygender][nameindexednmbr*][usedwords[nameindexednmbr*]];
		if ((i/6) == Math.floor(i/6)) {
			// if i is evenly divisible by 5 then i=5/10/15/20/25 or 30, which means we're at the end of a line
			// so we add a lf, otherwise add a bullet
			wordfadeadj.adjwords = wordfadeadj.adjwords+"
";
		} 
		else {
			//here is where we add the bullet between words (only works with font that renders bullet character)
			//wordfadeadj.adjwords = wordfadeadj.adjwords+" • ";
			// if it isn't the last word, add a bullet after it
			if (i < lettercount) { wordfadeadj.adjwords = wordfadeadj.adjwords+" • "; }
		}
	}
}