Terminating a while loop on an empty-line input

Hello,
I changed my code as follow:

function numbers()
    flag = 0
    sum = 0
    print("Enter the number: ")
    while ((flag = readline()) != "")
        print("Enter the number: ")
        sum += parse(Int,flag)
    end
    println("The summer is $sum")
end
numbers()

The only problem is that I have used two print commands to print the message.

1 Like