Hello.
There is something weird here, compiling this code:
:::basic
#chip mega328p, 16
Dim input( 10 )
Dim sum_input as byte
for num=1 to 10
input( num ) = num
next
sum_input = SumInputs( input() )
Function SumInputs( inp() )
SumInputs = 0
for num=1 to num_inputs
SumInputs += inp(num)
next
End Function
I get an array not declared error:
Great Cow BASIC (0.94 2015-08-05)
Compiling kk.gcb ...
An error has been found:
kk.gcb (16): Error: Array/Function INP has not been declared
The message has been logged to the file Errors.txt.
But this way it works ok:
:::basic
#chip mega328p, 16
Dim input( 10 )
Dim sum_input as byte
for num=1 to 10
input( num ) = num
next
sum_input = SumInputs( input() )
Function SumInputs( inp() )
tempbyte = 0
for num=1 to num_inputs
tempbyte += inp(num)
next
SumInputs = tempbyte
End Function
What am i doing wrong in the first case?
Thank you in advance.
......
Edited:
Just playing with text formatting
Last edit: Santiago 2015-09-24
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello.
There is something weird here, compiling this code:
I get an array not declared error:
Great Cow BASIC (0.94 2015-08-05)
Compiling kk.gcb ...
An error has been found:
kk.gcb (16): Error: Array/Function INP has not been declared
The message has been logged to the file Errors.txt.
But this way it works ok:
What am i doing wrong in the first case?
Thank you in advance.
......
Edited:
Just playing with text formatting
Last edit: Santiago 2015-09-24
What version of Great Cow Basic are you using?
And, can you post your code as attachment\zip?
Hi Anobium.
I'm using GCB 0.94 at linut Lubuntu 15.04
Attached the code not working for me: kk.gcb
Sorry for the big bold line in the last post.. i don't know how i did...
Try,
inp is reserved. Use inpx.
Please make sure you define your function to respond as you expect. You want to return a word or long.
Yes, with inpx i
t works perfectly.
And yes... forgot to declare the return type.
Thank you very much.