Why doesn't this character comparison equate to true?

   |i| (i+97).asAscii;
b=a.reject({|i| i=="d";});

Why doesn’t the reject function evaluate i==“d” correctly?

That is because "d" is not a character, but a string containing a single character. To get a character you need to use $d

~toascii = { |i| (i+97).asAscii };
a = 12.collect( ~toascii );
b = a.reject{ |i| i == $d };

FYI, you can write the reject line like this…

b = a.reject( _ == $d );

Out of curiosity, why are you converting numbers to ascii characters?

Thanks! That makes a lot of sense. I was converting to characters because it’s easier to do that than it is to type out an array of characters.