What do ! and # mean when attached to numbers in VB6?

后端 未结 3 624
情话喂你
情话喂你 2020-12-15 19:09

I have recently come across numeric literals such as 10! and 50# in Visual Basic programs. Could anyone tell me what these punctuation marks mean?

3条回答
  •  猫巷女王i
    2020-12-15 19:26

    Using these characters specifies the data type of a numeric literal.

    I thought this would be covered in the VB6 manual online but I can't find it.

    However I just proved it with the TypeName function in the VB6 IDE Immediate Window:

    ? typename(10!)
    Single
    ?typename(10#)
    Double
    ?typename(10%)
    Integer
    ?typename(10&)
    Long
    ?typename(10@)
    Currency
    

    PS Be aware that a VB6 Integer is 2 bytes, -32,768 to 32,767.

提交回复
热议问题