Is there a way to continue a long line of code across multiple physical lines? If so, it's hidden pretty well in the documentation because I couldn't find it. If not, could you add one please?
Thanks,
-djm
How to break lines of code?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: How to break lines of code?
In BASIC it is not possible to separate single code line into several physical lines if this code does not support multi-line syntax.
But there is no need to do it - long line automatically wraps into several lines of code if it does not fit into single line.
But there is no need to do it - long line automatically wraps into several lines of code if it does not fit into single line.
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: How to break lines of code?
About multi-line syntax:
some commands can be naturally coded in multiple lines.
For example:
IF a=b THEN do_something ELSE do_another_stuff
can be coded as:
IF a=b THEN
do_something
ELSE
do_another_stuff
END IF
some commands can be naturally coded in multiple lines.
For example:
IF a=b THEN do_something ELSE do_another_stuff
can be coded as:
IF a=b THEN
do_something
ELSE
do_another_stuff
END IF
Re: How to break lines of code?
Thanks for the quick reply! My problem is that I have (for example) something like:
WHILE <very long and convoluted Booloean expression involving nested ANDs and ORs and references to multidimensional arrays, etc.>
' do some stuff
END WHILE
It'd be nice if I could split that WHILE condition to format it in a more readable way, but I understand that SB isn't implemented that way. I guess I could do it just by inserting spaces and letting it wrap, but that's kind of gross. No problem; I just wanted to know.
Kudos in general for a really excellent interpreter!
-djm
WHILE <very long and convoluted Booloean expression involving nested ANDs and ORs and references to multidimensional arrays, etc.>
' do some stuff
END WHILE
It'd be nice if I could split that WHILE condition to format it in a more readable way, but I understand that SB isn't implemented that way. I guess I could do it just by inserting spaces and letting it wrap, but that's kind of gross. No problem; I just wanted to know.
Kudos in general for a really excellent interpreter!
-djm
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: How to break lines of code?
Thank you!
As for me, complex logical constructions I usually split into parts like that:
IF some_complex_expression THEN p1=1 ELSE p1=0
IF another_complex_expression THEN p2=1 ELSE p2=0
IF p1 OR p2 THEN do_what_needed
As for me, complex logical constructions I usually split into parts like that:
IF some_complex_expression THEN p1=1 ELSE p1=0
IF another_complex_expression THEN p2=1 ELSE p2=0
IF p1 OR p2 THEN do_what_needed