is it possible to write this using similar postfix...
# announcements
x
is it possible to write this using similar postfix notation? or am I stuck writing if == null
break if addByte == null else continue;
d
Yeah, you're "stuck" with
if (addByte == null) break else continue
.
👍 1
h
If you are breaking, do you need the else
d
Only if you want a one liner I guess.
h
Did he literally mean
continue
? I assumed it was a placeholder, if it's actually a
continue
what purpose would it serve.
d
Yeah, it is an actual
continue
. The
else
serves no real purpose. Only added it to stay close to the original snippet.
h
Well back to my main point then,
if (addByte == null) break
is equivalent to
if (addByte == null) break else continue
d
If there is no code after the
if
statement but he didn't say whether they was.
I thought you were thinking along the lines of
Copy code
if (addByte == null) break
continue
h
If there is code after
if (addByte == null) break else continue
it's unreachable.
d
Ah, that's true! Ignore me. 😅 (Although if there was indeed unreachable code for some reason then I'm right).
h
Hopefully that's not the case 😛
x
even if it was dead code it'd be better than the "C" (in java) I'm translating it from
but yeah, no, I was just thinking in perl that I wanted the break first, now I've gotten rid of the loop