Question: The following code is to add the font tag to every character, but it don't work

```
Function AddFontTag (counter)
    Do While Len (counter) < 7
        newStr = newStr & "<font>" & Left (counter, i) & "</font>"
        i = i + 1
    Loop
    AddFontTag = newStr
End Function

```

Because i'm not skilled in classic asp, such as variable scope, syntax. Does anyone know what's the problems of the above code?

thanks

Answer: 
Your `do..while` loop is an infinite loop - assuming `counter` is a string variable, its length never changes so if `Len(counter)` is less than `7` upon entering the function, it'll always stay less than `7` so your function never exits.

Your `newStr` variable is undefined - this works in VBScript but it's really bad practice and it's a source of countless errors. Is it a global variable or is it supposed to be a local? (It looks like a local.)
your codes is looping without a condition to EXIT the looping.
try this... hope it helps.

```
Function AddFontTag (counter)
dim i,newStr,max
max=7
    Do While Len (counter) < max
        newStr = newStr & "<font>" & Left (counter, i) & "-" & "</font>"
        i = i + 1
        if i = max-1 then exit Do
    Loop
    AddFontTag = newStr
End Function
'to check the results
response.write AddFontTag ("params")

```

you will get
 `<font>-</font><font>p-</font><font>pa-</font><font>par-</font><font>para-</font><font>param-</font>`