crystal-community / icr

Interactive console for Crystal programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Output of command only works once

beanilsson opened this issue · comments

commented

This is what happens when I'm trying to execute small code pieces within icr:
screen shot 2017-05-24 at 14 45 46

I only get an output on the first attempt. I'm running crystal within an Ubuntu Vagrant box.

commented

I just realised that the mistake was my own. One cannot use single quotes for strings in crystal, but double quotes should be used. Funny though how icr seems to freeze when single quotes are used, that ought to be a bug? Maybe there should be some sort of error message printed to the user as well? Like: Double quotes must be used. And then prompting for new input.

The bug is that you used the Char literal and not String literal. Crystal throws an error for that I believe, so we just need to catch that error and return it. That should be an easy fix.