How to skip output for `nothing` during ternary evaluation in one-liner list comprehension?

Suppose I only want to know success but not failure in a statement like:

julia> [i%2==1 && "even" for i in 1:10]
10-element Vector{Any}:
      "even"
 false
      "even"
 false
      "even"
 false
      "even"
 false
      "even"
 false

To stop this loop from outputting false, I tried the following but it doesn’t work:

julia> [i%2==1 ? "even" : nothing for i in 1:10]
10-element Vector{Union{Nothing, String}}:
 "even"
 nothing
 "even"
 nothing
 "even"
 nothing
 "even"
 nothing
 "even"
 nothing

How can I get this one-liner to just give:

5-element Vector{Union{Nothing, String}}:
 "even"
 "even"
 "even"
 "even"
 "even"
["even" for i in 1:10 if i%2 == 1]
6 Likes
filter(!=(false),[i%2==1 && "even" for i in 1:10])

filter(!=(0),(%).(1:10,2).==1) .&& "even"

fill("even", 10)[(%).(1:10,2).==1]