class When {
value = null;
found = false;
result = null;
constructor(value) {
this.value = value;
}
function is(expected, action) {
if (!found && value == expected) {
found = true;
result = action();
}
return this;
}
function isNot(expected, action) {
if (!found && value != expected) {
found = true;
result = action();
}
return this;
}
function isType(typeName, action) {
if (!found && typeof value == typeName) {
found = true;
result = action();
}
return this;
}
function isNull(action) {
if (!found && value == null) {
found = true;
result = action();
}
return this;
}
function inRange(min, max, action) {
if (!found && value >= min && value <= max) {
found = true;
result = action();
}
return this;
}
function match(condition, action) {
if (!found && condition(value)) {
found = true;
result = action();
}
return this;
}
function otherwise(action) {
if (!found) {
result = action();
}
return result;
}
}
function when(value) {
return When(value);
}
local x = 65;
local result = when(x)
.isNull(@()"is Null")
.isType("float", @()"Not Float")
.is(100, @()"Max")
.inRange(0, 35, @()"0~35")
.inRange(35, 70, @()"35~70")
.match(@(v) v * 2 > 150 && v < 80, @()"75~80")
.otherwise(@()">80");
print(result); // out 0~35

C:\Users\hp\AppData\Local\VCMP_Browser\app-1.7.2\resources\extraResources\file\style.css path and edit it..!