Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Subroutine declaration incorrectly allows return type to be defined

A subroutine is defined as a function shortcut which returns type void, by either explicitly calling, “return“ or not including a return. The BrightScript subroutine incorrectly allows a subroutine to declare a return type allowing the subroutine to compile. A subroutine can “return” or not include a return, but if a subroutine should return a variable, we recommend declaring a function with a return type.

See Program Statements | ProgramStatements-Function()AsType/EndFunction for more information about subroutines and functions. It correctly mentions that a subroutine only returns a void type (“The Sub statement can be used instead of Function as a shortcut for creating a function with return type Void").

Panel
borderColor#3D3D3D
bgColor#F4F4F4
titleColor#3D3D3D
borderWidth0
titleBGColor#3D3D3D
borderStylesolid

ON THIS PAGE

Table of Contents
indent20px