Pergunta

How would this loop be done in Xtend?

for (char character = '\0'; character != PacketConstants.STRING_TERMINATOR; character = (char) buffer.get())

I have read the documentation and tried several different things, I cannot get it to work.

Foi útil?

Solução

There is no for(;;) loop in Xtend. You should use while loop instead:

var char character = 0 as char
while (character != PacketConstants.STRING_TERMINATOR) {
    character = buffer.get() as char
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top