DEV Community

Sadie
Sadie

Posted on

 

Success !

One night before my coding bootcamp begins, and I'm working my way through exercises in the prep work that I didn't get to this winter. Here is a little Ruby redactor I finally got to work !

puts "Text to search through : "
text = gets.chomp
puts "words to redact : "
redactstring = gets.chomp
word = text.split(" ")
w = []
word.each do |word|
w.push(word)
end
redact = redactstring.split(" ")
r = []
redact.each do |redact|
r.push(redact)
end

i=0
while i<w.length
w.each do |word|
if r.include?word
print "REDACTED "
else
print word + " "
end
i+=1
end

end

Oldest comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.