[Coco] Basic09 Whats Wrong.
coco at jechar.ca
coco at jechar.ca
Fri Oct 19 18:36:18 EDT 2018
Yes the problem is fixed with that code for a.b09
Do you know if I use an on error command in basic09 and there
is an error if/how I can trap the error number ?
On 2018-10-19 15:13, Wayne Campbell wrote:
> I will look at them more closely this evening, but I can tell you the
> first
> one errors because you can't pass numbers from the command line as
> numbers.
> Shell+ treats all parameters as strings. You have to convert the
> strings to
> numbers before you operate on them.
>
> PARAM x,y:STRING
> DIM a,b:INTEGER
>
> a:=VAL(x)
> b:=VAL(y)
>
> I have to look up the error codes but I think the second is seeing a
> garbage string and can't process it.
>
> On Fri, Oct 19, 2018, 11:58 AM <coco at jechar.ca> wrote:
>
>>
>> Two simple programs but neither correct
>>
>> program a.b089 results in an error 27 when loading is attempted.
>> program t.b089 results in an error 69 when loading is attempted.
>>
>> Code for a.b089 follows:
>> PROCEDURE a
>> PARAMETER a,b:INTEGER
>> PRINT a+b
>> END
>> Code for t.b089 follows:
>> PROCEDURE t
>>
>> PARAM x,y:STRING
>>
>> IF y="" THEN
>> PRINT"Two parameters required."
>> ENDIF
>>
>> IF y<>"" THEN
>> PRINT "X=",x
>> ENDIF
>>
>> IF y<>"" THEN
>> PRINT "Y=",y
>> ENDIF
>>
>> END
>>
>> Why ?
>> --
>> Coco mailing list
>> Coco at maltedmedia.com
>> https://pairlist5.pair.net/mailman/listinfo/coco
>>
More information about the Coco
mailing list