News:

SMF - Just Installed!

Main Menu

Script Programming

Started by david.olilveira, March 17, 2023, 05:54:47 PM

Previous topic - Next topic

david.olilveira

how do you write an "and" statement
how do you write an "or" statement

EasyPLC_Master

#1
Using C# syntax:

AND -> &&

OR -> ||


david.olilveira

ok, ill be more specific, my fault

I am going through the tutorial package again, this time I am attempting to do them all in script instead of ladder.  (maybe not a good idea?) I'm currently on exercise 2.

I am attempting to create an AND statement with 2 inputs,

Example of what I think I need to achieve:

If(StartButton == true) AND if(Lever == false)
{
     Motor = true;
}


thank you,

EasyPLC_Master

#3
OK not problem to write the logic using the script code.

The syntax is:

if (StartButton && !Lever)
{
     Motor = true;
}

Or also:

if (StartButton == true && Lever == false)
{
     Motor = true;
}