Programming With Ruby Episode 2, Getting Started

preview_player
Показать описание
In this episode you will install Ruby and write your first program "Hello World!"



code:
puts "Hello World!"
Рекомендации по теме
Комментарии
Автор

Hi!

There are two ways to fix this. Either run the program from the command line (Start Menu->Accessories->Command Prompt). Or add gets to the end of the program.

manwithcode
Автор

@Paetilium I'm happy you like them :)

manwithcode
Автор

thanks a lot this is great for beginers like me!

patheticpassion
Автор

@stanmarshk True! I forgot about that! Thanks for reminding me :)
So yeah, everyone with a mac, you can use xcode to write ruby programs

manwithcode
Автор

Yep, the program does everything it needs to do and then exits immediately after that, not leaving you enough time to see what it printed out. Either run it directly from the command prompt (if you don't know how, google can help you) or add "gets" (without quotes) to the end of the program, which will wait for a line of input before it exits, allowing you to see the results, and then simply press enter to end it.

manwithcode
Автор

@julianhoogvorst SciTE is just a text editor, you don't need it. Any text editor will work fine (even notepad). If you're having issues getting one installed, just do a Google search, Google is your friend.

manwithcode
Автор

@julianhoogvorst Coloring of the code is a feature of more advanced text editors. If you want something like that, get Notepad++, or do a Google search for "programmer's text editor". There are numerous places that show how to run a ruby program, again a simple Google search should help you.

manwithcode
Автор

then to open the folder you DO NOT click on it. just right click and select "edit" thats where you do all the programming. Now to view your program, you go to your command prompt and type "cd desktop" press enter then type "cd programs" press enter.then type "test" and it will come out.

USANAmillionaire
Автор

@julianhoogvorst Try running the file from the command line. Ruby files don't necessarily set themselves up to run when you click on them, unless you used the rubyinstaller. If you don't know how to run it from the command line, google tells all.

manwithcode
Автор

@cashjamesPremium1 The code is running, but it finishes so fast that you don't actually get to see what it prints out. Try running it from the command prompt (if you don't know how, do a Google search on it).

Or, you can add "gets" (without quotes) to the end of the program, and it will stay visible until you press enter.

manwithcode
Автор

When getting a ruby version, you should always get a even number version if you are just starting, as they are stable versions, E.G: 1.9.2 1.8.6

zowlyfon
Автор

use geany its able to use any language you want and will auto detect whats a syntax and whats not like a variable

trevornida
Автор

I'm sorry you aren't finding these tutorials very helpful! My goal wasn't to explain everything in excruciating detail, because the audience I made these for was people who had programmed in other environments who wanted to get up-to-speed on basic Ruby, who would be bored to tears by explanations of tiny details they already know. If you have some specific questions, you can email me, and I can try to explain things. I'm quite busy these days, so no guarantee I'll be able to respond quickly...

manwithcode
Автор

use whatever you want to use, but I still think Ruby is better.

manwithcode
Автор

No problem! :) Sorry it took me so long to respond :P

manwithcode
Автор

Actually, I did a google search and if you add
sleep x
to the end of the program it stays up for x seconds.

ThordanSsoa
Автор

How do I get the window to stay up, I'm having the same problem as arinlares. The window just flashes up and then disapears before I can read it.

ThordanSsoa
Автор

@julianhoogvorst When you say it didn't work, what do you mean? How did it fail?

manwithcode
Автор

@Minecrafterz1000 Did you install Ruby correctly?

manwithcode
Автор

when I run hello world with notepad++ it just flashes it for a second and than closes. how do i fix this?

FingerSneeze
welcome to shbcf.ru