PicoMite V6.00.02 release candidates - all versions


Author Message
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3073
Posted: 05:25am 07 Jun 2025      

  Quote  When calling a subroutine you can supply less than the required number of values and in that case the missing values will be assumed to be either zero or an empty string.
BYVAL appears not to adhere to that.
> LIST
' Test prog 1
Dim integer a=5, b=6, c=7
 Print "a, b, c =";a;b;c
test a,,c

Sub test(BYVAL a, BYVAL b, BYVAL c)
If a = 5 Then
 a = 10
 Print "In Sub a, b, c =";a;b;c
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
>

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

Sub test(a, b, c)
If a = 5 Then
 a = 10
 Print "In Sub a, b, c =";a;b;c
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 0 7
After Sub a, b, c = 5 6 7
>

BYVAL appears to be the default anyway.

Senility advancing.
Edited 2025-06-07 16:01 by phil99