Forum: Ruby "alert" is not working.

Posted by Radu M. (radu_m)
on 2012-11-12 18:03
Hi.I tried to make a simple app like showing a window that says:Good
morning!
And I tried this code:
alert "Good morning"
But it isn't working when I try to run it in CMD(going in CMD and throw
it in the CMD window). It just says:
C:/Documents and Settings/radu/Desktop/goodmorning.rb:1:in `<main>':
undefined method `alert' for main:Object (NoMethodError)


And when I put the code in Hackety Hack and RubyKids it is working
Posted by Brian Candler (candlerb)
on 2012-11-12 19:23
That's because plain ruby doesn't have an "alert" method. For normal 
ruby, try this:

    puts "Good morning"
Posted by Radu M. (radu_m)
on 2012-11-12 23:36
Brian Candler wrote in post #1084118:
> That's because plain ruby doesn't have an "alert" method. For normal
> ruby, try this:
>
>     puts "Good morning"

Ok...Thanks
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.