Search code examples
legacy-codeqbasic

What are # and : used for in Qbasic?


I have a legacy code doing math calculations. It is reportedly written in QBasic, and runs under VB6 successfully. I plan to write the code into a newer language/platform. For which I must first work backwards and come up with a detailed algorithm from existing code.

The problem is I can't understand syntax of few lines:

Dim a(1 to 200) as Double
Dim b as Double
Dim f(1 to 200) as Double
Dim g(1 to 200) as Double

For i = 1 to N
 a(i) = b: a(i+N) = c
 f(i) = 1#: g(i) = 0#
 f(i+N) = 0#: g(i+N) = 1#
Next i

Based on my work with VB5 like 9 years ago, I am guessing that a, f and g are Double arrays indexed from 1 to 200. However, I am completely lost about this use of # and : together inside the body of the for-loop.


Solution

  • : is the line continuation character, it allows you to chain multiple statements on the same line. a(i) = b: a(i+N) = c is equivalent to:

    a(i)=b
    a(i+N)=c
    

    # is a type specifier. It specifies that the number it follows should be treated as a double.