Adding +prog inside an if statement in teddy

Hello everybody,

Is it possible to activate particular modules/programs INSIDE an if statement in Teddy?
I mean something similar to the following code:

if (condition)
+prog …
head

end
else
+prog …
head

end
endif

Hello

As far as I know this is not possible.
If you require this program behavior, you have to work with grasshopper or another supported programming language.

Best regards
Frederik Höller
Your SOFiSTiK Support Team

In Sofistik-manual is written (i don’t no if it works):
2.9.4 #IF - Conditional Input
IF THEN ELSE constructions can be defined. This means that larger input blocks can be inserted and removed, which is more difficult using the IF constructions in CADINP, and that several program calls can be grouped in one block.

The relevant control lines are familiar to all C-Programmers. In the first column the following possibilities can be used:
#if expression
any line, also PROG and SYS
#else
any line, also PROG and SYS
#endif

”expression” may be just the name of a block or a variable which is evaluated to be true if it is defined and not empty and not equal to zero. But it might be also a comparison $(MODE)==EC or $(MODE) < >EC or $(MEMBERS)>3. Be aware however that the comparisons are purely lexically based on strings, adjusted to the right for numbers, and to the left for all other cases. Therefore we have A < B, AA < BA, 10 < 18 but unfortunately also 10.0 > 12.

If ”expression” is not true, the first block will be skipped and the block after #else will be used. Naturally the second block can be omitted if not needed.

These constructions can be nested in up to 32 levels. An unmotivated #else or #endif will lead to errors, as well as an unfinished construction.

Example:
#define DOAQB=0
#if DOAQB
PROG AQB
HEAD …
LC …
DESI …
END
#endif

2 Likes

Ah yes you are right.
#if works as described.

Thanks for the input :wink:

It works. Thank you very much! :slight_smile: