Wendy Campbell they do not need parentheses, actually. because we are just concatenating a string, all you need are the quotation marks to designate it as a string.
Her is the program from day 15 #!/usr/bin/env ruby puts "Paste your document here:" document = gets.chomp puts "What word would you like removed?" remove = gets.chonp target_word = document.split(" ") target_words.each do |a_word| if a word != remove print a word + (" ") else print "RMOVED " end end When I pull it into the Command prompt I receive an error Any suggestions
Wild Academy great job teaching please respond but this is the way to get it so you could just open the file and not command promp puts "Paste Your Document Here" document = gets.chomp puts "What word would you like removed" remove = gets.chomp puts "What word would you like there instead" target_words = document.split(" ") new_word = gets.chomp target_words.each do |a_word| if a_word != remove print a_word + (" ") else print new_word + (" ") puts ",press enter to close the program" end_program = gets.chomp end end
Awesome video my dude I'm learning alot from you!
Great videos! Any way to not make the removal case-sensitive?
The Plaintiff Blackburn has requested that the defendant no longer contact her.
Is it necessary to put parentheses around the quotes in the if/else statement? I used just quotes with a space and it seemed to work ok
hi thanks Jake what is the function of .each do ?
What if i have multiple identifiers like space, coma, pull stop in the document. could you please explain
Why do the speech marks in + (" ") need to be in parenthesis?
Wendy Campbell they do not need parentheses, actually. because we are just concatenating a string, all you need are the quotation marks to designate it as a string.
u shall try to remove a word "her" that dot in the end of the sentence doing bad things. actually, any punctuation will break that rule we did.
Her is the program from day 15
#!/usr/bin/env ruby
puts "Paste your document here:"
document = gets.chomp
puts "What word would you like removed?"
remove = gets.chonp
target_word = document.split(" ")
target_words.each do |a_word|
if a word != remove
print a word + (" ")
else print "RMOVED "
end
end
When I pull it into the Command prompt I receive an error
Any suggestions
you did if a word != remove its if a_word != remove
Brad Winborg you also did remove = gets.chonp
I dont understand the space
could be as simple as that? text[word] = replace
Wild Academy great job teaching please respond but this is the way to get it so you could just open the file and not command promp
puts "Paste Your Document Here"
document = gets.chomp
puts "What word would you like removed"
remove = gets.chomp
puts "What word would you like there instead"
target_words = document.split(" ")
new_word = gets.chomp
target_words.each do |a_word|
if a_word != remove
print a_word + (" ")
else print new_word + (" ")
puts ",press enter to close the program"
end_program = gets.chomp
end
end
There's a gem that reads your clipboard to make Ruby detects what you have copied before, just saying...