proc/type2text(str)
var/i
while(findtext(str,"/"))
i = findtext(str,"/")
str = copytext(str,i++)
I tried this, but it's not quite right:
proc/type2text(str)
var/i
while(i = findtext(str,"/"))
str = copytext(str,i++)
Interestingly enough, I thought this should be syntactically valid, but it's not (the errors I get are kind of silly):
proc/type2text(str)
var/i
i = while(findtext(str,"/")) {
str = copytext(str,i++) }
Cheers
-- John M.
Your second attempted fix is silly (not the errors being silly). In no language can you make a variable equal to a loop like that.
Your main attempt will yield an infinite loop should there be ANY form of text (whether it be a space, symbol, etc) after the forward-slash.
Your basic rule for using a loop is that any conditions being tested by the loop must change at some point during the loop or else an infinite loop will occur.
When using loops, you have to be careful and make sure that the loop WILL end eventually.