Splitting code across lines?

Everything else that doesn't fall into one of the other PB categories.
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Splitting code across lines?

Post by pdwyer »

In many flavours of basic you can split code up using an underbar something like this

Code: Select all


b = 3
a = 1

If a=1 Or _
    b=2
    
    Debug a
    Debug b
EndIf
But in PB, while it doesn't flag an error it doesn't work as if the if statement was:

[/code]
If a=1 Or b=2

Code: Select all


Is there some other way to do this when lines are getting too long to be readable?

Thanks
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Post by Foz »

No. Well. I say no - I think there was a massive discussion (argument ;)) about this not long ago, and I believe that you can now do with with CodeCaddy, which preprocesses the multiple lines into one long one - along with many other things.

But no, it isn't available for the main PB language.
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

:? Pity, as the IDE seems not to scroll properly to the right after a certain length. you have to use the arrow rather than drag.

Oh well. not going to get fixed over night either way I guess
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

npath
User
User
Posts: 74
Joined: Tue Feb 15, 2005 5:15 pm

Post by npath »

Wow, that would be nice...
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Post by Foz »

Only 5 screens? Pfft!

Lets up it to 31 screens for some of my If statements :lol:
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

except that it's not a monitor limitation
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Splitting code across lines?

Post by PB »

> Is there some other way to do this when lines are getting too long

This has been discussed here like a million times already (literally). :)
Just search for topics to do with line continuation. In fact, here's some
for you, all to do with multiline code support:

http://www.purebasic.fr/english/viewtopic.php?t=4876 (The FAQ!)
http://www.purebasic.fr/english/viewtopic.php?t=7426
http://www.purebasic.fr/english/viewtopic.php?t=18133
http://www.purebasic.fr/english/viewtopic.php?t=18160
http://www.purebasic.fr/english/viewtopic.php?t=17528
http://www.purebasic.fr/english/viewtopic.php?t=10553
http://www.purebasic.fr/english/viewtopic.php?t=4903

> the IDE seems not to scroll properly to the right after a certain length

Also already discussed. It's a Scintilla bug, as far as I remember reading.
Last edited by PB on Sat Dec 29, 2007 9:05 am, edited 1 time in total.
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

okay okay... I get the idea

It's not a show stopper, this just looks kind of ugly thats all

Code: Select all

    If (Board(1) + Board(2) + Board(3)) = 3 Or (Board(4) + Board(5) + Board(6)) = 3 Or (Board(7) + Board(8) + Board(9)) = 3 Or (Board(1) + Board(4) + Board(7)) = 3 Or (Board(2) + Board(5) + Board(8)) = 3 Or (Board(3) + Board(6) + Board(9)) = 3 Or (Board(1) + Board(5) + Board(9)) = 3 Or (Board(3) + Board(5) + Board(7)) = 3
        FuncRet = #Cross
    EndIf
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

I agree that it's needed.
Last edited by PB on Sat Dec 29, 2007 9:05 am, edited 1 time in total.
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

"The topic or post you requested does not exist"

Yes, I read about that and the discussions you linked to about IDE vs Compiler and whether it's going to break anything.

I'm not going to get too uptight about it though as there's nothing I can do about it. I don't really like pre-processors whether they be for this or oop or whatever so I don't intend to work around it.

It's not a feature than causes me to not be able to write something.

I'll live. I'll be happy if/when it's added.
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> "The topic or post you requested does not exist"

What's that in reference to?
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

Sorry, wrong post quoted.
Thalius
Enthusiast
Enthusiast
Posts: 711
Joined: Thu Jul 17, 2003 4:15 pm
Contact:

Post by Thalius »

@Pd:

i tend to use a Macro for such things ;)


Thalius
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone! ;)"
Post Reply