0

这个循环如何在 Xtend 中完成?

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

我已阅读文档并尝试了几种不同的方法,但无法使其正常工作。

4

1 回答 1

1

Xtend中没有for(;;)循环。您应该改用while循环:

var char character = 0 as char
while (character != PacketConstants.STRING_TERMINATOR) {
    character = buffer.get() as char
}
于 2013-09-12T09:19:46.733 回答