Alextophi said:
I rest my question correctly.
I have a table: @SCHED, it contains 8 fields: $SCHED[0] $SCHED[1]
$SCHED[2] $SCHED[3] $SCHED[4] $SCHED[5] $SCHED[6] $SCHED[7]
my problem is that certain fields are empty and I have errors of
initialization of variable.
- How to make a print of $SCHED[0] to [7]
in advance thank you for your assistance
Christophe
I think that you would find it more enjoyable to use Ruby.
=====
names = [ 'Christophe', 'William', nil, 'Elaine', 'Gunnar the Troll' ]
puts names
puts "-"
puts names.compact
=====
Output:
Christophe
William
nil
Elaine
Gunnar the Troll
-
Christophe
William
Elaine
Gunnar the Troll
If you need the indices:
=====
names.each_with_index { |s,i| puts "#{i}. #{s ? s : ''}" }
=====
Output:
0. Christophe
1. William
2.
3. Elaine
4. Gunnar the Troll
If you want only the names of humans:
=====
names.each_with_index { |s,i| s=nil if s && s.index("Troll")
puts "#{i}. #{s ? s : ''}" }
=====
Output:
0. Christophe
1. William
2.
3. Elaine
4.