The return value is definitely needed.
You haven't really given enough precise information but it is probably because Java, and hence B4X, short circuits conditional expression evaluation so in Code B, unless the key code is KEYCODE_BACK then Info.IsShow is not evaluated (because the expression can never be True) and hence does not raise the error.