Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
beginners question about freebasic
#1
When i try to compile the following freebasic code to compile i get an error message : 'expected end function, found ('.
I have no clue what i'm doing wrong. Can someone please help me? thanks in advance

--------------------------

dim tmp%(1 to 100)

Function test(p1 AS INTEGER) AS INTEGER

test = tmp%(p1)

END FUNCTION

------------------------
Reply
#2
Top of the head: does it make any difference if you change
dim to dim shared?
/post]
Reply
#3
That did it !

Thanks
Reply
#4
I've never seen dim ... (1 to n) before. Dynamic arrays?
.14159265358979323846264338327950288419716939937510582709445
Glarplesnarkleflibbertygibbertygarbethparkentalelelangathaffendoinkadonkeydingdonkaspamahedron.
Reply
#5
Code:
Dim array(x TO y) as some_type
Where x is any number, and y is any number greater than x.

It defines the starting point of the array.
So, the first element in the array would be x, the last would be y

Normaly, you ignore the x argument, and only pass y.
And thus get an array dimensioned 0 to y, which is the fastest and most efficient way to do it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)