[Solve]convert swithces to number

sory It work
just my typo on var Lang and lang in other line -***-


-----------------
my code
var Lang = $gameSwitches.value(20) === true ? 1 : 0 ;


I want to use this in array work
I know I can just check boolean and set it or use variable instead

but this format is interesting me
var i = result ? 1 : 0;
I found in stackoverflow web
and in orher plugin that I open to learn
but when I try it my self it not work

thank you
It helps if you use the Code tags to format your code on here and make it easier to read.
upload_2019-4-10_22-15-45.png


Any of these lines will convert the true/false into 1/0:
Code:
// Any of these are fine
var Lang = $gameSwitches.value(20) ? 1 : 0;   // test truthiness
var Lang = $gameSwitches.value(20) === true ? 1 : 0 ;  // test explicit true
var Lang = Number($gameSwitches.value(20));  // Number constructor with boolean argument
// These are technically the same but very confusing to read. Don't use these unless you want to be crazy
var Lang = +$gameSwitches.value(20);  // coerce boolean to number
var Lang = $gameSwitches.value(20) | 0; // bitwise OR operator
var Lang = ~~$gameSwitches.value(20);  // double bitwise NOT operator
The first group is the most readable which is always preferred.

Original thread: https://forums.rpgmakerweb.com/threads/solve-convert-swithces-to-number.107793/