syntaxbasicgw-basic

Unknown GW-BASIC function/syntax: Q(var) = var


I'm translating an excessively old GW-BASIC program into JavaScript, and I've come across a piece of syntax that has me stumped. Note (again): totally not my code, and the variable names are all insane, which is why I'm porting it in the first place.

1380 Z = 1
1390 RATIO = FCO2 /(1-FCO2-10^REFFO2)
1400 AA =(1 - 2*RATIO*(100 / MIXRATIO - 1))/(1 + 2*(100 / MIXRATIO - 1))
1410 PART = LOG(1 - AA)- LOG(100 / MIXRATIO - 1)
1420 FOR I = 1 TO - 1 STEP -2
1430 H = I
1440 W = T + H 
1450 GG = 62.110326# - .02144446#*W + 4.720326E-07*(W^ 2)+(- 4.5574288#)*(10^(- 12))*(W^ 3)- 7.343018200000001#*(10^(- 15))*(W^ 4) 
1460 KK = EXP(- GG /(R*(W + 273.18)))
1470 Q(Z)= KK 
1480 Z = Z + 1
1490 NEXT I
1500 NEWFO21 = LOG(10)*.5*(LOG(Q(1))+ PART):NEWFO22 = LOG(10)*.5*(LOG(Q(2))+ PART)
1510 DELEMFDELT =(FN EMF (TREF + 1,NEWFO21) - FN EMF (TREF - 1, NEWFO22))/2
1520 RETURN

The question mark is line 1470: Q(Z) = KK. Q is defined Q$ earlier in the program as a yes/no input variable, so it makes no sense for me to be putting a float in it. There's no Q() function defined in the program earlier, and I can't find a reference to a Q() function in GW-BASIC, either.

Any help?


Solution

  • Q and Q$ are separate variables. Anything with $ is a string variable. Q(Z) is an array of numbers.

    The 1 and 2 character names are common because in earlier versions of Basic, variable names were restricted to 2 characters max.