I Don't Exactly Understand Gets & omp. - Codecademy
Maybe your like
The description of both are not really explaining it thoroughly for me.
Also, when I try to satisfy the objective to (disregard quotations on outside):
“Declare a variable first_name and set it equal to gets.chomp.”
I put this (also disregard outside quotations):
“first_name = “Austin” gets.chomp”
And it gives me this (and again):
“(ruby): syntax error, unexpected tIDENTIFIER, expecting $end first_name = “Austin” gets.chomp”
Could you explain what I am doing wrong and possibly explain gets & gets.chomp a little more in depth?
Answer 50722ccd201e4100020297c5
5 votesPermalink
You should write : first_name = gets.chomp
“gets” is a method that asks the user to input something. “chomp” is a method that removes the blank line that is automatically created by “gets” after the input.
3 comments
Thank you. I was confused because after inputting what I originally did, I inputted what you said I should and it didn’t give me the completed sign.
I’ve input first_name = gets.chomp and it doesn’t give me the completed sign either… Could you , please , tell me what is wrong?
For further elaboration on the “gets.chomp” expression, check out Alex’s response in the following thread: http://www.codecademy.com/forum_questions/514073efffb67cff44004afe
Answer 533309db8c1cccdb2c002f27
0 votesPermalink
I Know the answer! Type this: first_name = gets.chomp after you did that a little black screen with a white block is coming in the right corner, now type the exact same thing in to the black screen so : gets.chomp and it will give the correct result.
Popular free courses
- Free course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.- Checker DenseBeginner Friendly.4 Lessons
- Free course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.- Checker DenseBeginner Friendly.11 Lessons
- Free course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.- Checker DenseBeginner Friendly.6 Lessons
Tag » What Is Chomp In Ruby
-
Ruby | String Chomp! Method - GeeksforGeeks
-
What Is The Chomp Method In Ruby?
-
How To Use The Ruby Gets & Ruby Chomp Methods - RubyGuides
-
How To Use "gets" And "omp" In Ruby - Stack Overflow
-
Chomp (String) - APIdock
-
Chomp Method In Ruby
-
What Does 'chomp' Mean In Ruby? - Quora
-
Ruby Chomp, Strip, Chop String Examples - Dot Net Perls
-
Ruby Chomp: The Easiest Way To Remove Unwanted New Lines
-
String Chop Vs Chomp - Ruby
-
Class: String (Ruby 3.1.2)
-
TIL: How Does .chomp Method Works? - DEV Community
-
Using Gets, Chomp, To_i, To_f, Math Module And Type Conversion In ...
-
Ruby Programming - 8 - omp Method - YouTube