How To

Multiline statement?

0

dredds 2019-04-10 06:13

Is there a way to lay out a statement across multiple lines? (e.g. like using the \ character at the end of a line in C)?

I do all my lowresnx programming on my iPhone and the code is quite hard to read when lines are too long for the screen width & wrapped by the editor.


was8bit 2019-04-10 07:53 (Edited)

No...


was8bit 2019-04-10 07:54

One trick is to break a line down, and use small variable names...


was8bit 2019-04-10 08:06

For example, take this code..

SUB DRAW_BUILDING(X)
TOP = 5 + INT(RND*10)
ROOF = 16 + 2*INT(RND*8)
CELL X, TOP, ROOF
CELL X+1, TOP, ROOF+1
FOR Y = 15 TO TOP+1 STEP -1
STORY = 32 + 2*INT(RND*8)
CELL X, Y, STORY
CELL X+1, Y, STORY+1
NEXT Y
END SUB

REPLACE WITH THESE....

SUB DBLD(X)
CALL DOR(5,1,10,TOP)
CALL DOR(16,2,8,RF)
CELL X,TOP,RF
CELL X+1,TOP,RF+1
TT=TOP+1
FOR Y=15 TO TT STEP -1
CALL DOR(32,2,8,STR)
CELL X,Y,STR
CELL X+1,Y,STR+1
NEXT Y
END SUB

SUB DOR(A,PM,M,R)
I=INT(RND*M)
R=A+I*PM
END SUB


was8bit 2019-04-10 08:07

DOR = DO RND


Timo 2019-04-10 09:37

I would prefer horizontal scrolling, but the standard iOS text editor doesn't support it. I agree that automatic line wrapping looks bad, but at the moment this doesn't have priority for me.


Log in to reply.