johnathenwhiter94
johnathenwhiter94

Reputation: 124

Looping in xtend, convert from Java

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.

Upvotes: 0

Views: 431

Answers (1)

ZhekaKozlov
ZhekaKozlov

Reputation: 39536

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
}

Upvotes: 1

Related Questions