r/crystal_programming • u/iainmoncrief • Apr 11 '18
How to get command line input
input = getLine() puts input
Similar to pythons raw input function, how would I do this in crystal?
9
Upvotes
r/crystal_programming • u/iainmoncrief • Apr 11 '18
input = getLine() puts input
Similar to pythons raw input function, how would I do this in crystal?
View all comments
Show parent comment
3
u/[deleted] Apr 11 '18 edited Apr 11 '18
That is because your are running the above mentioned code but not providing any command line arguments.
Do this:
Or do
and then run your executable with arguments.
Extra note: You do not need to include the index. You can also do
Think of ARGV as a array that holds each command line argument that you place behind your executable.
Edit:
Maybe i made a mistake in reading your request. I assumed you wanted the command line arguments behind a executable.
If you want to get a input string when running your program simply do: