x = 123 #think simple if x < 0 throw("Number less than zero.") elseif x >= 0 && x < 10 println("Number has one digit.") elseif x >= 10 && x < 100 println("Number has two digit.") elseif x >= 100 && x < 1000 println("Number has three digit.") else println("Number has more than three digits.") end ##### Or with the number of digits as before if x>0 digits = round(Int,log10(x))+1 if digits > 3 println("Number has more than three digits.") elseif digits == 1 println("Number has one digit.") else println("Number has $digits digits.") end elseif x==0 println("Number has one digit.") else throw("Number less than zero.") end