Today we’ll be going over the method gets.chomp. It will allow us to get a users input to create variables.
★ THE BEST EDITOR and IDE FOR PROGRAMMING ► http://bit.ly/Komodo-IDE-Learn-Ruby
★☆★ SIGNUP TO GET MY RUBY BOOK FOR FREE ★☆★
http://bit.ly/free-book-signup
★☆★ FOLLOW ME BELOW ★☆★
Twitter ► http://bit.ly/jake-day-twitter
YouTube ► http://bit.ly/jake-day-youtube
Facebook ► http://bit.ly/jake-day-facebook
SoundCloud ► http://bit.ly/jake-day-soundcloud
★☆★ NOTES ★☆★
Amazon Auto Links: No products found.
Hi Jake. I’m going through your series of tutorials. You’ve indicated a couple of times that you’ll list books you recommend on Ruby programming. It’s probably me, but I haven’t found them yet. Do you mind telling me what they are? Thanks!
excellent work , I agree
.When you type in your input and press your enter key the enter key also has its byte added. The chomp takes the character/byte out from the input. Do not forget the full stop -period if American – before chomp (.chomp )
yay! i’m the first! nice tuts easy to understand, i look forward to seeing the rest 🙂
I’m using the ruby app on my iphone, it’s doesn’t like chomp?
Oh I’m so excited about coding now! 😀 I’m having so much fun watching and following along with your videos. Thank you for making these! <3
how can you use gets.chomp to get input from a browser window (not the terminal)
i’m struggling with rails and connections the frontend with the backend – i love the gets.chomp method but i can’t seems to make it practical in ruby on rails
I keep getting “assigned but unused variable – user_input”. When I run it I get an Error FAIL: SIGTERM. I typed it in exactly as on the screen. Please help.
I love you
Not a problem . Do you have a box office?
Just started a boot camp and am very grateful I found your teachings. You are so slow and neat with a very clear strong voice.
why didn’t you use puts instead of print
awesome
I started to learn Ruby and for beginners this is best guide i found so far. U made your videos very good, cant wait to finish them all. (y)
I would like to thank you for sharing knowledge and doing an excellent job at it. My deepest appreciation goes to you Jacob. When I do make big money because of this trust me you wont be forgotten.
Thanks for taking the time to do this. Much respect.
I am coding on Sublime Text 3. gets.chomp doesn’t work on it. Please help!
Jake thank you so much for the videos
Great stuff man!
Thanks +Jacob Williams
What if you don’t have a middle name? If you put nothing after “Middle name?”, it will result in double spaces between first and last names.
Hey Jacob, I can’t find the video you’re talking about at the end of this one, where you can automatically be inputted into all the contests. Could you send a link please? Thanks.
” bold
I like to play with my code and change things up it’s really fun thank you.
You never explained what .chomps did !
sir can you make a vide on how to buy a domain name with dedicated server actually me and my friends know about domain name but dont know about dedicated server how to use dedicated server on windows or mac to hold all the data please help us and by the way your tutorial are awesome…
Where are the books?
So excited!!! Can’t wait to learn more…
Thank you for the tutorials!
your voice sounds a LOT like James Woods, there are times that i keep thinking i’m in the middle of white house down or once upon a time in america.
Thank you!
Hey Jacob, something interesting I noticed if you type
print “Please type your first name” (Notice here I don’t have a period at the end)
user_input = gets.chomp
puts “Your first name is #{user_input}!”
If I run this program it will ask for my name but it wont return it. Only if I put period at the end of the print statement it will return my name. So I am guessing that a period is mandatory ??
Liked and subbed, this series is awesome. THANK YOU!! 😀
Thanks for simple and beautiful lessons =)
Most usefull line of code to now in my opinion 😛
You could also explain why the chomp method is used with gets.
The reason why chomp is used when getting input is because each input you get adds a new line after, to get rid of it you have to use the chomp method so you only get the user input.
Wew I started to feel that ruby is more and more flexible than C++, the capitalize method is very nice, either it is flexible or the rules are not so monstrous like in C++, yi er san yi er san, let’s dig in more lesson.. hehe
JAKE question! i have a working basic client and server and im trying to use what i’ve learned from your videos in this script but its not working. it’s not giving me an error either. here is the code its very short and simple.
require “socket”
server = TCPServer.open(“localhost”, 2000)
loop {
thread.start(server.accept) do |nodervcr|
msg = nodervcr.gets
puts (msg)
}
but when I add in that loop , a series of if then else commands, it does NOT recognize what I want it to ( nor anything for that matter) ; It’s acting as if “nodervcr” is only good for that firts “puts(msg) after that i can’t use it! whats going on here? how do i get the incomign message from the client as a variable so i can redirect the script accordingly?