In stack-based languages such as PostScript or Forth, a command which subtracts the topmost number on the stack from that beneath it, leaving the result on the top of the stack.


5 3 sub => 2

In Visual Basic , a sub is short for a subroutine (that terminology is inherited that from its loose BASIC roots). The main difference between a sub and a function is that a sub doesn't (can't) return anything. A sub also does not have a comparative value, as a function would in C or VB. Therefore:

sub sub1

MsgBox "Hello world"

end sub

if sub1 > 0 then ....

The above code would error out, because subs have no value.

Note, this node is accurate as on VB6

Sub, n.

A subordinate; a subaltern.



© Webster 1913.

Log in or register to write something here or to contact authors.