Forum Discussion
renojim
16 years agoCommunity Streaming Expert
If you want to always have an 'end if', then don't put the return on the same line:
I'd say it isn't always necessary to check the msg type if the port is only associated with one type of component, but it does make the code more readable. Also, if your port is associated with more than one component, like a Springboard screen and an audio player, then your code would crash if you received an roAudioPlayerEvent and you had 'if msg.isScreenClosed() then' since there is no isScreenClosed() event for an audio player. There are quite a lot of events where msg.GetMessage() returns an empty string. In fact, it's probably something that is used less often than the other means of testing for the purpose of the message.
-JT
if x=1 then
return
end if
I'd say it isn't always necessary to check the msg type if the port is only associated with one type of component, but it does make the code more readable. Also, if your port is associated with more than one component, like a Springboard screen and an audio player, then your code would crash if you received an roAudioPlayerEvent and you had 'if msg.isScreenClosed() then' since there is no isScreenClosed() event for an audio player. There are quite a lot of events where msg.GetMessage() returns an empty string. In fact, it's probably something that is used less often than the other means of testing for the purpose of the message.
-JT