Teletype feature request: also

I have a question/request.

I often find myself wanting an ‘also’ command to follow an If command. So when If is true, it executes what follows and then on the next line: could say. Also: such and such. Or is there some way to do this already?

1 Like

I don’t believe there is, but I’ve often wanted/wondered about this. This probably isn’t an elegant workaround, and my guess is you’ve probably wound up doing this already, but:

For simple conditions like “IF X: command; command”, It’s not a big hit on character count to just write the if statement again on the following line. But this presumes the first commands don’t alter X. And this is maybe most applicable to if, as other conditional statements get longer.

If you had a line to spare you could have a longer condition which you assigned to X on the line before a conditional, and still keep the if condition short.

This would check that both TR 1 and TR 2 are currently high and then execute the following 2 lines of commands.

X AND TR 1 TR 2
IF X: commands
IF X: still more commands

With that being said, I would also be in favor of some sort of operator (or ideally maybe just a symbol, tho I bet they are scarce) which ties 2 or more lines to the condition on the 1st.

2 Likes

What if there were a line continuation character? like ‘\’ or parenthesis right after the IF to allow all lines after in between ‘(…)’ to be within the same statement? I’m not sure if this goes against the conventions of TT.

Probably mixing our paradigms, but for some reason I wind up thinking about it like a soft return from page layout software like indesign (Shown here as 2). Where if we gave that a keyboard shortcut (from page layout shift+return), and used that symbol at the end of your line it at the end of your line, it’d treat the next line as a continuation of the first. And any line not ending in the soft return would be treated as a hard return.

If I’m understanding what you want also to do, you can invert the conditional and break. All lines after that will only be executed if that is not true

IF "NOT" X: BREAK
THIS LINE EXECUTES WHEN `IF X`
AND THIS ONE
AND THIS ONE
8 Likes

That’s an interesting solution. I’ll give it a try!

1 Like