PicoMite V6.00.02 release candidates - all versions


Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11065
Posted: 07:13am 07 Jun 2025      

  Quote  Oops - looks like a bug in MMBasic!

(b should default to 0 in test.)


No it isn't. You are just printing the value of a global variable which wasn't passed. Try

' Test prog 1
Dim integer a=5, b=6, c=7
Print "a, b, c =";a;b;c
test a,,c

Sub test(BYVAL x%, BYVAL y%, BYVAL z%)
If x% = 5 Then
x% = 10
Print "In Sub x% y%, z% =";x%;y%;z%
EndIf
End Sub

Print "After Sub a, b, c =";a;b;c
> RUN
a, b, c = 5 6 7
In Sub a, b, c = 10 6 7
After Sub a, b, c = 5 6 7
>