用于确定是否初始化Perl值的命令

Wor*_*ter 0 arrays perl groovy initialization ternary-operator

我现在的问题是基于我在CSV文档中遇到的问题,但它也更普遍.

我希望在Java/Groovy/Gosu中使用类似null的问号来确定数组索引是否已初始化.

我有类似的东西:

for ( my i = 0; i < @engVals or i < @frenchVals; i++ ) {

    $csv->print($file, [ $engVals[i] ?: "",  , $frenchVals[i] ?: "" ] );

    # Where Elvis ops ensure that the array element at i is initialized, and if not stores blank in the CSV
}
Run Code Online (Sandbox Code Playgroud)