FAQ: Redacted! - What You'll Be Building

This community-built FAQ covers the “What You’ll Be Building” exercise from the lesson “Redacted!”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn Ruby

FAQs on the exercise What You’ll Be Building

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hi,
the redacted program is not allowing me to enter the word that has to be redacted. Instead, the original text is once again printed. Why would that be?

1 Like

I wrote a simple snippet to hide the redacted string with asterisk, could this be implemented in the course by default?

    # paste over line 12 (print "REDACTED ")
    length = redact.length
    counter = 0
    until counter == length
      counter += 1
      print "*"
    end

Hi!

Am I the only one struggling with the “chomp” function ? I feel like something is wrong anytime I include it in my code.

In the case at hand I ran the template program without even modifying it but the following error message appears every time : “execution expired”.

1 Like

Yes, I’ve noticed the same thing when using .chomp. Not always, or in every lesson, but frequently enough to be a bit frustrating. I’ve noticed that you have to be quick to type in a response in the console. That seems to help most of the time. Good luck!

2 Likes

Riiiiiiiiight! Just got it, wasn’t understanding that I was supposed to type something in the console :rofl: thanks a lot!

1 Like

Why in this lesson are we defining a variable named words and then calling a variable named word? This should not work?

Hello, @array3789857647. Welcome to the forum.
Actually the way the variables are used in the lesson it works quite well. Here’s a more simple example of how the .each method works:

my_array = ["My", "dog", "has", "fleas."]

my_array.each do |potato_soup| #the variable between the pipes | | is a placeholder
  print potato_soup + " " #the placeholder holds each value of the array one at a time
end

Output:

My dog has fleas.

The .each method will allow us to perform some action(s) involving each element of an array. In my cheesy example, I take an array of words, and combine them into a sentence by printing them one at a time. The variable between the | |'s will hold each element of the array one at a time, so we can refer to it in our code. We can give the placeholder variable any legal variable name. In the lesson, using a variable named word to hold the values of the words array makes perfect sense. My example makes little sense, but illustrates the concept that the name of the placeholder can vary to our individual taste. Whatever we put between the | |'s is the name we use in our code.

Thank you! Finding the material a little laconic in some areas so this forum will be a huge help.

1 Like

So the example at the very start of this chapter, I click run. It asks me to enter a phrase, I do and then it times out with “execution expired” why is it not displaying the second puts so that I can enter the word to be redacted? I haven’t touched the code yet this is the starting example…