Post by Stefan Pendl on May 6, 2021 4:03:53 GMT -5
The following code results in a missing ELSE or END IF statement error.
'test build-in global variables.bas
'Author: Stefan Pendl
'Date: 06.05.21
globalVariables$ = "CommandLine$ DisplayWidth DisplayHeight Drives$ DefaultDir$ Version$ NullColumn$ NullColumn SpecialKey$ Inkey$ Platform$ StartupDir$"
globalVariables$ = globalVariables$; " UpperLeftX UpperLeftY WindowWidth WindowHeight Err Err$"
globalVariables$ = globalVariables$; " BackgroundColor$ ComboboxColor$ TextboxColor$ TexteditorColor$ ForegroundColor$ ListboxColor$"
globalVariables$ = globalVariables$; " PrintCollate PrintCopies PrinterFont$ PrinterName$"
i = 1
while word$(globalVariables$, i) <> ""
varLen = len(word$(globalVariables$, i))
if varLen > maxLen then maxLen = varLen
i = i + 1
wend
dim gVariables$(i-1)
i = 1
while word$(globalVariables$, i) <> ""
gVariables$(i) = word$(globalVariables$, i)
i = i + 1
wend
sort gVariables$(), 1, i-1
for j = 1 to i-1
print gVariables$(j); " "; replstrLb5$(space$(maxLen + 3 - len(gVariables$(j))), " ", "."); " "; eval$(gVariables$(j))
if val(Version$) = 5 then if right$(gVariables$(j), 1) = "$" then print
next
end
function replstrLb5$(string$, find$, replace$)
replstrLb5$ = ""
for i = 1 to len(string$)
current$ = mid$(string$, i, 1)
if current$ = find$ then
replstrLb5$ = replstrLb5$; replace$
else
replstrLb5$ = replstrLb5$; current$
end if
next
end function
I think the following line is causing the issue, which works without problems in LB 4.5.1
if val(Version$) = 5 then if right$(gVariables$(j), 1) = "$" then print
Thanks in advance for a fix.