Hey there, I’m trying to exit an event using a continue, the same I use inside a loop, but that’s not compiling, compiler says me “continue is not in a loop”. How can I go out of that event inside my condition?
Do you want to exit the function early? In that case, you should use return.
return is most often used to return a value from a function, but it can also be used to return early.
By the way, declaring variables in main but only using them in the function passed to OnNewMessage sounds like a recipe for mysterious bugs, since if multiple messages arrive simultaneously, they will share the same variables for crcCalculado and crcPacote.
Like @andybalholm has suggested, simply replace continue with return. You are not currently in a loop, but are inside of a function closure, so you would exit it the same way you would with a regular early return from a function.