Please enable JavaScript to view this site.

Checks if a variable or expression has changed its value since the previous analysis.

Syntax

i32 diff (var)

var

Parameter to be checked.

Must be of type numeric (i8, i16, i32, u8, u16, u32, float, real) or boolean (logical expression)

Result

Returns:

Value

Description

<> 0

Variable changed value from previous analysis

0

Otherwise

Validity

Rule, Task

Note

The first time it is executed, the function returns FALSE and stores the current state of the condition.

In case diff() is used in a user R3 function, it should be avoided that the parameters of the function itself are involved in the "condition" expression. The result would not be as hoped because of the overlap in memory of the state of multiple variables

Each diff() instruction has its own memory of the "condition" state.

The evaluation of the front is done between the current state of the condition and the memory related to the single function call.

For example, if we have at step 1000 if(diff(inp(1 ))) and at step 1100 if(diff(inp(1))), though they refer to the same condition, the evaluations are done separately, each according to the stored state, by executing step 1000 and then step 1100.

 

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Contents: ALT+c
Search: ALT+s
Exit Menu/Up: ESC