How about this:
x = 123456789
digits = Int[]
while x != 0
rem = x % 10
push!(digits, rem)
x = div(x,10)
end
println(digits)
To do this in the style in which you did it (which you probably shouldn't do), you can do
x = 123456789
digits = [int(string(c)) for c in string(x)]
println(digits) # {1,2,3,4,5,6,7,8,9}
c in string(x) , c::Char. int(c) Chapter ASCII, , .