why can a variable declaration do this?

GFA, ASM, STOS, ...

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

why can a variable declaration do this?

Postby charles » Wed Oct 14, 2009 11:59 pm

i been playing with omikron and noticed a example code can adheare to this format ,, but only in omikron .... this is flexable but also udmbfounding ,, why would they permit such behaviour and would it be benificial?

here is an example
strg$=" "*256
print strg$

but then the string is only three "| " colons

or

local i$=" "*128

who knows what this does i freaked when the first example worked ,????

like is it multipling the orinigal word into a new string or does it repeat as many times as it's bound too?

omikron v.4 i believe

charles
atari is my lifestyle,not a hobby.
User avatar
charles
Atari God
Atari God
 
Posts: 1330
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada

Re: why can a variable declaration do this?

Postby charles » Thu Oct 15, 2009 10:10 pm

ignore this threaDd please , i got differnet results from version 3,.01 of omikron to version 4.0 of omikron...

version four will make a string of letters specified in S$
like S$="F"*4 will result in FFFF

but version 3 calculated like a math equation ,might be buggy ,

sorrry
charles
atari is my lifestyle,not a hobby.
User avatar
charles
Atari God
Atari God
 
Posts: 1330
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada

Re: why can a variable declaration do this?

Postby lp » Fri Oct 16, 2009 2:53 pm

s$=STRING$(4,"F");

Does the same, but works in all versions of GFA. :wink:
User avatar
lp
Atari Super Hero
Atari Super Hero
 
Posts: 949
Joined: Wed Nov 12, 2003 11:09 pm

Re: why can a variable declaration do this?

Postby charles » Fri Oct 16, 2009 10:40 pm

lonny in your expert opinion why does gfa have these 2 options? just from different versions
of gfa carried through the years i suspect ?

#1
s$=space$(90)

or

#2
s$=string$(90," ")

same stuff , no?

charles
atari is my lifestyle,not a hobby.
User avatar
charles
Atari God
Atari God
 
Posts: 1330
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada

Re: why can a variable declaration do this?

Postby lp » Sat Oct 17, 2009 3:46 am

You over look the obvious.
One is more common and thus easier to remember.
Also one is faster, since less parameters.
User avatar
lp
Atari Super Hero
Atari Super Hero
 
Posts: 949
Joined: Wed Nov 12, 2003 11:09 pm


Return to Coding

Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests