Problem with taking inputs in Visual Studio Code

I’m new to julia, I’ve been trying to solve a normal problem using programming. The question involves me to take input and organise it. I’ve been trying to do it, although I’m not getting any problem in the julia terminal or jupyter notebook, VS code terminal is showing some problem. Could anyone suggest what to do?

The input I am giving is
“—
-m-
p–”

(The inverted commas are just to consolidate the input, they aren’t part of the input)

Hi Kamal,

Looking at stack-trace, parse is throwing an error, my guess is your 1st input -- is being used for parsing.
I tried the same code in my VS Code by running the script in the terminal using command →
julia parse.jl, which works fine for me.

m = readline()
m = parse(Int64, m)
grid = []

for i in 1:m
    a = readline()
    push!(grid, a)
end
println(grid)

output :

3
--
-m-
p--
Any["--", "-m-", "p--"]

when i run the code inside julia REPL, i had to actually type 1st input 2 times, bcz it is neglecting 1st input somehow…

1 Like

Ahh, ok
gotcha

It is somehow neglecting the first input (i.e 3) I’m giving in VS code, then it is trying to parse ‘-’ into Int64 which is not valid.

Thanks a lot for your help

1 Like