wtd, ruby questions
Author |
Message |
dsantamassino
|
Posted: Tue Nov 09, 2004 6:38 pm Post subject: (No subject) |
|
|
wtd wrote: Post the code you write. Please surround it with code tags, like so:
code: | [code]This is formatted as code.[/code] |
I dont know how nor what u mean.. I barely can qoute so i dont know how to use the code tags |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Tue Nov 09, 2004 6:43 pm Post subject: (No subject) |
|
|
Copy and paste your code into a post. At the beginning of your code, type:
And at the end of it, type:
Just don't use spaces between the e and ]. |
|
|
|
|
|
dsantamassino
|
Posted: Tue Nov 09, 2004 7:08 pm Post subject: (No subject) |
|
|
when i went to edit greet.rb.. I cant figure out how to litteral copy or highlight the text to copy it then come to this board by clicking on the right my mouse then paste. Sorry but i dont know how to do it.. |
|
|
|
|
|
wtd
|
Posted: Tue Nov 09, 2004 7:15 pm Post subject: (No subject) |
|
|
Select the text normally with your mouse. DOS-style applications are a bit weird about selecting text. Start at the top-left corner and drag down to the bottom right corner.
While the text is selected, right-click. Congratulations. You just copied test the DOS way.
Right-click again in a DOS-style app to paste.
In a normal program, just paste normally. |
|
|
|
|
|
dsantamassino
|
Posted: Tue Nov 09, 2004 9:59 pm Post subject: (No subject) |
|
|
wtd wrote: Select the text normally with your mouse. DOS-style applications are a bit weird about selecting text. Start at the top-left corner and drag down to the bottom right corner.
While the text is selected, right-click. Congratulations. You just copied test the DOS way.
Right-click again in a DOS-style app to paste.
In a normal program, just paste normally.
I have not a single clue what your talking about. From what i have saved on my C: drive it says something totally different from the edit greet.rb file. I dont have a clue how to copy it. It will NOT let me copy it from the command window.. |
|
|
|
|
|
wtd
|
Posted: Tue Nov 09, 2004 10:10 pm Post subject: (No subject) |
|
|
dsantamassino wrote: It will NOT let me copy it from the command window..
Yes. It will.
Can you find no way to show me the program you wrote, so I can help you further? |
|
|
|
|
|
dsantamassino
|
Posted: Tue Nov 09, 2004 10:15 pm Post subject: (No subject) |
|
|
well i found out how to copy it from edit greet.rb from start-->> Run-->>cmd but now can figure out how to paste it to this board. when i right clicked on this board its not pasting my output.. |
|
|
|
|
|
wtd
|
Posted: Tue Nov 09, 2004 10:18 pm Post subject: (No subject) |
|
|
dsantamassino wrote: well i found out how to copy it from edit greet.rb from start-->> Run-->>cmd but now can figure out how to paste it to this board. when i right clicked on this board its not pasting my output..
Just right-click and select "Paste". |
|
|
|
|
|
Sponsor Sponsor
|
|
|
dsantamassino
|
Posted: Tue Nov 09, 2004 10:21 pm Post subject: (No subject) |
|
|
wtd wrote: dsantamassino wrote: well i found out how to copy it from edit greet.rb from start-->> Run-->>cmd but now can figure out how to paste it to this board. when i right clicked on this board its not pasting my output..
Just right-click and select "Paste".
Yeah thats what i did but its not pasting my output |
|
|
|
|
|
wtd
|
Posted: Tue Nov 09, 2004 10:30 pm Post subject: (No subject) |
|
|
Ok, stick with me, I think I can help with one last idea.
code: | C:\> notepad greet.rb |
That should open the file in a new Notepad window, and copying and pasting is the standard procedure, then. |
|
|
|
|
|
dsantamassino
|
Posted: Tue Nov 09, 2004 10:33 pm Post subject: (No subject) |
|
|
code: | puts "John R.Doe?"
name = gets
puts "Hello " + John R.Doe + "!" |
|
|
|
|
|
|
wtd
|
Posted: Tue Nov 09, 2004 10:41 pm Post subject: (No subject) |
|
|
Ok, there are various steps to solving this problem.
- Ask for the person's first name
- Get their first name and store it in a variable
- Ask for their middle name
- Get that name and store it in a variable
- Ask for their last name
- Store that name in a variable
- Say hello, concatenating (adding) their first, middle, and last names into one name
The problem you're having with the code you pasted is that you don't quite seem to understand the purpose of a variable. A variable is just a convenient name for a piece of data.
The variable in the code you pasted was "name". When you add together the strings in the last line of code, use that variable name.
code: | puts "John R. Doe?"
name = gets
puts "Hello " + name + "!" |
|
|
|
|
|
|
dsantamassino
|
Posted: Tue Nov 09, 2004 10:45 pm Post subject: (No subject) |
|
|
wtd wrote: Ok, there are various steps to solving this problem.
- Ask for the person's first name
- Get their first name and store it in a variable
- Ask for their middle name
- Get that name and store it in a variable
- Ask for their last name
- Store that name in a variable
- Say hello, concatenating (adding) their first, middle, and last names into one name
The problem you're having with the code you pasted is that you don't quite seem to understand the purpose of a variable. A variable is just a convenient name for a piece of data.
The variable in the code you pasted was "name". When you add together the strings in the last line of code, use that variable name.
code: | puts "John R. Doe?"
name = gets
puts "Hello " + name + "!" |
I finally got it..
here is the output when i run ruby greet.rb
John R. Doe? |
|
|
|
|
|
wtd
|
Posted: Tue Nov 09, 2004 10:47 pm Post subject: (No subject) |
|
|
You'll have to type something and hit enter before the program should terminate. |
|
|
|
|
|
dsantamassino
|
Posted: Tue Nov 09, 2004 10:49 pm Post subject: (No subject) |
|
|
wtd wrote: You'll have to type something and hit enter before the program should terminate.
OK i got it. |
|
|
|
|
|
|
|