Brendan L. Brendan L. - 6 months ago 32
Groovy Question

Command to find out if a Perl value is initialized

My question right now is based around a problem I'm having with CSV documents but it is also more general.

I'm looking to use something like the null question mark in Java/Groovy/Gosu to determine if an array index has been initialized.

I have something like:

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