September 26, 2020, 06:11:51 pm

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


illlegal assingment

Started by TexasPete, August 16, 2009, 05:54:10 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TexasPete

August 16, 2009, 05:54:10 am Last Edit: August 16, 2009, 06:04:32 am by TexasPete
I am getting and illegal assignment error with the following line of code:
I do have it dimensioned properly using
dim FontPadding[8]:int

FontPadding[1]=1:FontPadding[2]=2:FontPadding[3]=3:FontPadding[4]=4:FontPadding[5]=4:FontPadding[6]=5:FontPadding[7]=5:FontPadding[8]=5

Never mind everyone in converting the older Lb program I had accidently put it as a string instead of an interger.

Thanks Texas Pete

aurelCB

Hi TexasMan... :)
Yes every array in Creative start with zero index.
Se this small example:

Code Select
'array of strings with 8 elements
DEF win:window
DEF FontPadding[8]:string
' every array in CBasic is zero based ...
FontPadding[0]="MS Sans Serif"
FontPadding[1]="Arial"
FontPadding[2]="Impact"
FontPadding[3]="Courier New"
FontPadding[4]="Georgia"
FontPadding[5]="Lucida Console"
FontPadding[6]="Tahoma"
FontPadding[7]="Verdana"

Window win,0,0,400,300,@minbox,0,"String Array",main
Setwindowcolor win,rgb(255,255,230):'lightyellow

SetFont win,FontPadding[0],8,400,0
Move win,10,20:Print win,"MS Sans Serif - size(8)"

SetFont win,FontPadding[1],10,400,0
Move win,10,40:Print win,"Arial - size(10)"

SetFont win,FontPadding[2],12,400,0
Move win,10,60:Print win,"Impact - size(12)"

SetFont win,FontPadding[3],10,400,0
Move win,10,80:Print win,"Courier New - size(10)"

SetFont win,FontPadding[4],12,400,0
Move win,10,100:Print win,"Georgia - size(12)"

SetFont win,FontPadding[5],10,400,0
Move win,10,125:Print win,"Lucida Console - size(10)"

SetFont win,FontPadding[6],12,400,0
Move win,10,140:Print win,"Tahoma - size(12)"

SetFont win,FontPadding[7],10,400,0
Move win,10,160:Print win,"Verdana - size(10)"


WAITUNTIL win=0
END


SUB main
select @class
case @IDclosewindow
closewindow win
case @idcreate
centerwindow win
endselect
RETURN


Aurel
forum for hobby programming:<br />https://aurelsoft.ucoz.com