Page 1 of 1

[Implemented] multi var declaration

Posted: Tue Mar 02, 2004 7:55 pm
by MLK

Code: Select all

x,y,z=1
;x=1
;y=1
;z=1

Global x=1,y,z=2 ;this option would be nice too

Posted: Tue Mar 02, 2004 8:45 pm
by LarsG
now *this* one, I miss too..
I'm sure it would be a nice addition to PB.. :)

Re: multi var declaration

Posted: Tue Mar 02, 2004 8:49 pm
by GPI

Code: Select all

x,y,z=1
;x=1
;y=1
;z=1
Hmm, i don't think, that this would be a good idea...

[/code]
Global x=1,y,z=2 ;this option would be nice too
[/code]

But this would be nice...

Re: multi var declaration

Posted: Tue Mar 02, 2004 10:44 pm
by freedimension
MLK wrote:

Code: Select all

x,y,z=1
;x=1
;y=1
;z=1
Never seen this one. I like the way C handles this:

Code: Select all

x=y=z=1
As for the second: Yes, that would be very handy.

Posted: Wed Mar 03, 2004 12:36 am
by freak
Jippee, another feature for us lazy guys :D

The "x=y=z=1" is not basic styl though. You usually don't have multiple
'=' in one line.

You have my vote for the Global thing.

Timo

Re: multi var declaration

Posted: Wed Mar 03, 2004 4:52 pm
by GPI

Code: Select all

x=y=z=1
This is not allowed in Basic. The first "=" is intrepreated as a "Set X to" and the next two are compares: x=z and (x=z)=1.

Your Example will only work, when "Set a Variable" and "is equal" have two diffent chars.

Posted: Thu Mar 04, 2004 12:57 pm
by MLK
last night i had a dream:

Code: Select all

Globals
    x.l=4
    y.w
    z.f=1.23
EndGlobals
same for declares..

dont want to open a new topic. but what do you think about this, instead of:

Code: Select all

global this
global that
global this, and, that
this=1
that=2

Posted: Thu Mar 04, 2004 2:03 pm
by Saboteur
MLK wrote:last night i had a dream:

Code: Select all

Globals
    x.l=4
    y.w
    z.f=1.23
EndGlobals
I like it... ;)

Posted: Thu Mar 04, 2004 2:16 pm
by freak
I do understand the request for this:

Global a=5, b=6

But the other thing just doesn't make sense to me.
Why not put it in one line?

btw, do you also want to add Shareds/EndShareds, Protecteds/EndProtecteds, Statics/EndStatics??
That's a lot of unneded commands imho.

TImo

Posted: Thu Mar 04, 2004 2:30 pm
by MLK
freak wrote:Why not put it in one line?
because, at larger codes, there are sometimes many globals. that would result in a long line and isnt very clearly arranged. and no - i dont request that for everything, only for globals and maybe for declares.

Posted: Thu Mar 04, 2004 4:19 pm
by techjunkie
MLK wrote:
freak wrote:Why not put it in one line?
because, at larger codes, there are sometimes many globals. that would result in a long line and isnt very clearly arranged. and no - i dont request that for everything, only for globals and maybe for declares.
Ehhhh - don't get this... You don't need to have ALL variables on one line, do you?

You can write,

Code: Select all

Global a, b=1, c, d
Global e=6, f, g
Global h, i , j

Posted: Thu Mar 04, 2004 4:33 pm
by MLK
i know..

Posted: Thu Mar 04, 2004 4:37 pm
by techjunkie
MLK wrote:i know..
so, what's the problem?!?! :?:

Posted: Thu Mar 04, 2004 4:46 pm
by MLK
its no problem. its a request.

Posted: Thu Mar 04, 2004 4:52 pm
by Dare2
It looks neater.

Code: Select all

StartGlobal
   var.l
   etc.l
EndGlobal
Adds nothing to the compiled prog either.

And doesn't mean can't still use

Code: Select all

Global var.l, etc.l

But before all that:
  .. NOT
  .. SGN
  .. structureComplete=otherStructureComplete
  .. Fixed length strings capable of containing an embedded binary 0
  .. Double Precision
  .. Logical operators acting logically in expressions.

And etc.