Page 1 of 3

Splitting code across lines?

Posted: Fri Dec 28, 2007 3:12 pm
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

Posted: Fri Dec 28, 2007 3:45 pm
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.

Posted: Fri Dec 28, 2007 4:10 pm
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

Posted: Fri Dec 28, 2007 5:38 pm
by Derek

Posted: Fri Dec 28, 2007 6:24 pm
by npath
Wow, that would be nice...

Posted: Fri Dec 28, 2007 7:58 pm
by Foz
Only 5 screens? Pfft!

Lets up it to 31 screens for some of my If statements :lol:

Posted: Sat Dec 29, 2007 3:57 am
by pdwyer
except that it's not a monitor limitation

Re: Splitting code across lines?

Posted: Sat Dec 29, 2007 4:44 am
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.

Posted: Sat Dec 29, 2007 5:08 am
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

Posted: Sat Dec 29, 2007 5:25 am
by PB
I agree that it's needed.

Posted: Sat Dec 29, 2007 6:34 am
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.

Posted: Sat Dec 29, 2007 7:11 am
by PB
> "The topic or post you requested does not exist"

What's that in reference to?

Posted: Sat Dec 29, 2007 7:20 am
by pdwyer

Posted: Sat Dec 29, 2007 9:04 am
by PB
Sorry, wrong post quoted.

Posted: Sat Dec 29, 2007 11:45 am
by Thalius
@Pd:

i tend to use a Macro for such things ;)


Thalius