If statements

Hello,
Is it possible to create if statements within AnyBody, like the if
statements in Matlab?

I was attempting to use a switch variable to create an On or Off
status, then use the status in an if statement. However, after
creating the switch variable, it cannot be reassigned.

AnySwitchVar Status = Off

Status = On <-------- AnyBody won’t compile this change in Status

I tried the same using an integer variable and got the same results.

Can an AnyBody variable only be assigned once?

Brent

Hi Brent

Yes, the variables can only be assigned once.

So I am afraid that it is impossible to define parts of the script which can
be switched in and out using if statements.

I am not sure if it will solve your problem but there are a number of
functions available in AnyBody

eqfun equality test

ltfun larger than function

andfun and function

orfun or function

iffun if function

you can find a description of these functions in the reference manual

<http://www.anybodytech.com/fileadmin/AnyBody.2.x.x/doc/AnyBodyRefManual.pdf
>
http://www.anybodytech.com/fileadmin/AnyBody.2.x.x/doc/AnyBodyRefManual.pdf

Here is the description of the iffun:

This class defines a function for making conditional statements in an
expression. The function takes

three arguments. The first argument is the condition, where zero is equal to
’false’ and a nonzero

value is ’true’. The second argument is the return value in case of a true
condition and the third

argument is the return value for false.

So I guess this is not exactly what you are looking fore but maybe you can
use it for solving your problem.

Best regards

Søren, AnyBody Support


From: anyscript@yahoogroups.com [mailto:anyscript@yahoogroups.com] On Behalf
Of blulrey
Sent: 16. september 2006 03:08
To: anyscript@yahoogroups.com
Subject: [anyscript] If statements

Hello,
Is it possible to create if statements within AnyBody, like the if
statements in Matlab?

I was attempting to use a switch variable to create an On or Off
status, then use the status in an if statement. However, after
creating the switch variable, it cannot be reassigned.

AnySwitchVar Status = Off

Status = On <-------- AnyBody won’t compile this change in Status

I tried the same using an integer variable and got the same results.

Can an AnyBody variable only be assigned once?

Brent

[Non-text portions of this message have been removed]