Question
· Jun 21, 2022

Inline IF and assignment

I'd like to to assign a value to a variable, depending on the results of a condition. The equivalent of what can be done in c++ with the following:

(a>b) ? a=1:a=0;

Or in python:

a = 1 if a>b else 0

This makes the code much more readable and compact.

In objectscript it would be:

if (a>b){
    a=1
} else{
    a=0
}
Product version: IRIS 2021.1
Discussion (4)2
Log in or sign up to continue