Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello World Example Issues #7

Closed
Jeeppler opened this issue Sep 10, 2016 · 1 comment
Closed

Hello World Example Issues #7

Jeeppler opened this issue Sep 10, 2016 · 1 comment
Labels

Comments

@Jeeppler
Copy link

Hello,

I wanted to use the hello world example from this page:
https://crystal-lang.org/2013/07/10/hello-world.html

but I encountered the following error:

Can't infer the type of instance variable '@name' of Greeter

    @name = name.capitalize
    ^~~~~

I fixed the issue, by adding a property statement

class Greeter
 property name : String
  def initialize(name)
    @name = name.capitalize
  end
  ....
end

Another issue while trying to compile:

$ bin/crystal hello.cr
$ ./hello
Hello World
$

this does not work anymore. It is enough to simply use:

$ bin/crystal hello.cr

and if you want to produce an executable:

$ bin/crystal compile hello.cr
$ ./hello

My crystal version is: Crystal 0.18.2 (2016-06-17) [on Archlinux]

I think it would be a good idea to update this example.

By the way I really like that you show the hello world example as simple puts, class and block.

@asterite
Copy link
Member

Thank you for reporting this! Fixed in 2072fe3

@asterite asterite added the bug label Sep 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants