¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: Question on finding the number of defined array elements.


 

Why?

You're just saying if some condition is true, then do nothing. Not
exactly something I'd typically see someone programming, but it *IS*
perfectly valid.

--- In Crestron@..., "Matt" <mjrtoo@...> wrote:

I would have expected to see a compiler error on the fatal ; at the
end of an IF statement.



True, but I always put them in so that if I do add another line I
don't mess up the execution order/nesting. (Didn't see the ; -
fatal,
but a trace should have shown 10 outputs rather than just 1.)

Lindsay

--- In Crestron@..., "Matt" <mjrtoo@> wrote:

Thanks Lindsay and Chip, it's always puntuation isn't it. If I
were
to remove the trace statement, could you use no brackets? If the
brackets are required, I guess there's another error in the help
file.



Hi Matt,

You need to put the statements after the IF in {}.

Lindsay

--- In Crestron@..., "Matt" <mjrtoo@> wrote:

I'm messing around with an upcoming project, and am looking
to
determine the number of elements a string array has been
assigned
in
Simpl. Looking at S+ I see the directive isSignalDefined().
I
have
the following code (not complete).

STRING_INPUT in$[10][25];

Function Main()
{
FOR(i = 10 to 1 Step -1)
{
IF(IsSignalDefined(in$[i]));
TRACE("i = %d", i);
BREAK;
}
}

Within Simpl, I have only two strings expanded on the symbol,
but
NumSources always = 10, I was expecting to see 1.

Is this the correct approach and/or any advice on what's
incorrect?

Join [email protected] to automatically receive all group messages.