Qbasicnews.com
October 22, 2019, 03:25:49 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Why does using STATIC give me an error?  (Read 2870 times)
BiLLaMoNsTeR
New Member

Posts: 7



WWW
« on: February 04, 2005, 12:44:01 AM »

This works in QBASIC, but not in FreeBASIC for some reason.
It says duplicated definition for "dim array(47) as integer".

Code:

sub subname ()
static array() as integer, notfirst

if notFirst = 0 then
   notFirst = 1
   dim array(47) as integer
end if

end sub


Am I doing something wrong?

EDIT: Whoops, I just figured out that doing "STATIC array(47)"  to dimension the variable works.
Logged
relsoft
*/-\*
*****
Posts: 3927



WWW
« Reply #1 on: February 04, 2005, 02:47:05 AM »

redim?
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
barok
Na_th_an
*****
Posts: 1727


How about a tasty lead sandwich?


« Reply #2 on: February 04, 2005, 02:51:56 AM »

maybe array's a keyword or something?   I dunno...  I recall something about how you have to have '$dynamic (or just DYNAMIC now) or something'll happen to variables.  

I got nothing. :lol:
Logged

Jumping Jahoolipers!
v3cz0r
I hold this place together
*****
Posts: 924



WWW
« Reply #3 on: February 05, 2005, 06:42:03 PM »

STATIC syntax is FB is the same as with DIM or REDIM, not like in QB where you have to declare the array twice, simple do:

static somearray(lowerbound to upperbound, ...) as sometype

lowerbound and upperbound can't be variables, only constant expressions.
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!