## Ventuz (C#.NET) Expression Syntax

I regret but I belong to the species of Ventuz artists, who don’t know how to script. Yes they exist. I try to solve most of these things with expressions, only to hear from the Species who know how to script, that everything could be done a lot easier.(Guys your’re really helping me – and I would never think that you’re arrogant.)

Now the problem, which isn’t kind of an everyday one, occured that i need a specific syntax. Again and again I ask myself every six months how this or those syntax for an OR-AND etc. expression looks like. (At this point I want to thank Karol from Ventuz for listening to my ever-repeating questions and for answering them with patience over and over again.)

Assuming that I’m not the only one, here’s a list of different syntaxes for the expressions in Ventuz. (I found this list somewhere and it’s probably a 120 years old, but as I don’t want to check all of them again, I just post it like this. So there’s no guarantee for being complete or functioning – if you have more information about this, please send an e-mail to Info (at) stereolize.com)

**Ventuz (C#.NET) Expression Syntax**

**input-argruments:**

a treated as double

b treated as double

c treated as double

d treated as double

**expression-result-type:**

double The expression must result in a type of double.

**cast-operator:**

() A cast explicitly invokes the conversion operator from expr’s type to type:

( type ) expr

**supprted-types:**

bool boolean (true, false)

byte 8-bit unsigned integer

sbyte 8-bit signed integer

short 16-bit signed integer

ushort 16-bit unsigned integer

int 32-bit signed integer

uint 32-bit unsigned integer

float 32-bit IEEE floating point value

double 64-bit IEEE floating point value

Decimal 128-bit IEEE floating point integer

**binary-operators:**

**+ **Binary + operators are predefined for numeric and string types. For numeric types, + computes the sum of its two operands.

**- **Binary – operators are predefined for all numeric and enumeration types to subtract the second operand from the first.

*** **The multiplication operator (*) computes the product of its operands. All numeric types have predefined multiplication operators.

**/** The division operator (/) divides its first operand by its second. All numeric types have predefined division operators.

**%** The modulus operator (%) computes the remainder after dividing its first operand by its second. All numeric types have predefined modulus operators.

**&** Binary & operators are predefined for the integral types and bool. For integral types, & computes the bitwise AND of its operands. For bool operands, & computes the logical AND of its operands; that is, the result is true if and only if both its operands are true.

**|** Binary | operators are predefined for the integral types and bool. For integral types, | computes the bitwise OR of its operands. For bool operands, | computes the logical OR of its operands; that is, the result is false if and only if both its operands are false.

**^ **Binary ^ operators are predefined for the integral types and bool. For integral types, ^ computes the bitwise exclusive-OR of its operands. For bool operands, ^ computes the logical exclusive-or of its operands; that is, the result is true if and only if exactly one of its operands is true.

**<< **The left-shift operator (<<) shifts its first operand left by the number of bits specified by its second operand.

**>>** The right-shift operator (>>) shifts its first operand right by the number of bits specified by its second operand.

**== **For predefined value types, the equality operator (==) returns true if the values of its operands are equal, false otherwise.

**!=** The inequality operator (!=) returns false if its operands are equal, true otherwise.

**>** All numeric and enumeration types define a "greater than" relational operator (>) that returns true if the first operand is greater than the second, false otherwise.

**<** All numeric and enumeration types define a "less than" relational operator (<) that returns true if the first operand is less than the second, false otherwise.

**>=** All numeric and enumeration types define a "greater than or equal" relational operator (>=) that returns true if the first operand is greater than or equal to the second, false otherwise.

**<=** All numeric and enumeration types define a "less than or equal" relational operator (<=) that returns true if the first operand is less than or equal to the second, false otherwise.

**unary-operators**:

+ The result of a unary + operation on a numeric type is simply the value of the operand.

- The result of a unary – operation on a numeric type is the negation of the operand.

! The logical negation operator (!) is a unary operator that negates its operand. It is defined for bool and returns true if and only if its operand is false.

~ The ~ operator performs a bitwise complement operation on its operand. Bitwise complement operators are predefined for int, uint, long and ulong.

?: The conditional operator (?:) returns one of two values depending on the value of a Boolean expression. The conditional operator is used in an expression of the following form: cond-expr ? expr1 : expr2

**math-function:**

Math.Abs(x) Returns the absolute value of a specified number.

Math.Acos(d) Returns the angle whose cosine is the specified number.

Math.Asin(d) Returns the angle whose sine is the specified number.

Math.Atan(d) Returns the angle whose tangent is the specified number.

Math.Atan2(y,x) Returns the angle whose tangent is the quotient of two specified numbers.

Math.BigMul(a,b) Produces the full product of two 32-bit numbers.

Math.Ceiling(d) Returns the smallest whole number greater than or equal to the specified number.

Math.Cos(w) Returns the cosine of the specified angle.

Math.Cosh(w) Returns the hyperbolic cosine of the specified angle.

Math.DivRem(a,b,res) Returns the quotient of two numbers, also passing the remainder as an output parameter.

Math.Exp(d) Returns e raised to the specified power.

Math.Floor(d) Returns the largest whole number less than or equal to the specified number.

Math.Log(a) Returns the natural (base e) logarithm of a specified number.

Math.Log(a,newBase) Returns the logarithm of a specified number in a specified base.

Math.Log10(a) Returns the base 10 logarithm of a specified number.

Math.Max(a,b) Returns the larger of two specified numbers.

Math.Min(a,b) Returns the smaller of two numbers.

Math.Pow(a,pow) Returns a specified number raised to the specified power.

Math.Round(a) Returns the number nearest the specified value.

Math.Sign(a) Returns a value indicating the sign of a number.

Math.Sin(w) Returns the sine of the specified angle.

Math.Sinh(w) Returns the hyperbolic sine of the specified angle.

Math.Sqrt(a) Returns the square root of a specified number.

Math.Tan(w) Returns the tangent of the specified angle.

Math.Tanh(w) Returns the hyperbolic tangent of the specified angle.

**math-contants:**

Math.PI Represents the ratio of the circumference of a circle to its diameter, specified by the constant,

π: 3.14159265358979323846

Math.E Represents the natural logarithmic base, specified by the constant,

e: 2.7182818284590452354

**examples:**

a + b returns the sum of a and b.

(a+1.0)*b returns the product of b and the sum of a and 1.

Math.Sin(w/180.0*Math.PI) return the sine of the in degrees given angle.

Math.Asin(a)*180.0/Math.PI return the inverse sine of the given value a and converts the radiants into degrees.

a<0 ? 0 : a returns a only if a is greater or equal to zero, otherwise return zero.

( a<10 ? 10 : ( a>20 ? 20 : a ) ) returns a clamped into the bounds of 10 and 20

(double) (int) a Converts a into a integral value (all fractions are removed) and converts back to double.

**remarks:**

The entered expression is inserted in the following template before compiled with the Microsoft™ .NET™ C# Compiler:

public class EXPRCLASS

{

public static double EXPR( double a, double b, double c, double d )

{

return <expression>;

}

}

where <expression> is substituted.

I do agree with all of the ideas you’ve introduced to your post. They’re very convincing and can definitely work. Nonetheless, the posts are very quick for starters. Could you please prolong them a bit from next time? Thank you for the post.

Hi there,

As a programmer, i can tell you that there is nothing special about this list of operators, as these are ones used in C#, as well as in any other programming language that stems from the C syntax, like Java, C++,Javascript and so on.

This said, there are particuliarities when it comes to scripting in Venutz. one of the main advantages is the visual programming, the plugging of functional bricks to more complex functions. If you are quicker with the mouse and a few keystrokes, then why not do it?

Cheers,

Christophe Leske