What does DIM stand for in Visual Basic and BASIC?

后端 未结 10 2137
忘掉有多难
忘掉有多难 2020-11-30 20:39

What does DIM stand for in Visual Basic?

10条回答
  •  攒了一身酷
    2020-11-30 21:14

    It's short for Dimension, as it was originally used in BASIC to specify the size of arrays.

    DIM — (short for dimension) define the size of arrays

    Ref: http://en.wikipedia.org/wiki/Dartmouth_BASIC

    A part of the original BASIC compiler source code, where it would jump when finding a DIM command, in which you can clearly see the original intention for the keyword:

    DIM    LDA XR01             BACK OFF OBJECT POINTER
           SUB N3
           STA RX01
           LDA L        2       GET VARIABLE TO BE DIMENSIONED
           STA 3
           LDA S        3
           CAB N36              CHECK FOR $ ARRAY
           BRU *+7              NOT $
           ...
    

    Ref: http://dtss.dartmouth.edu/scans/BASIC/BASIC%20Compiler.pdf

    Later on it came to be used to declare all kinds of variables, when the possibility to specify the type for variables was added in more recent implementations.

提交回复
热议问题