Share your repls and programming experiences

← Back to all posts
Chat bot in Ruby 2.5.0
Bloxy_Cola (15)

A chat bot I made in Ruby 2.5.0

Commentshotnewtop
k4t3xpl0si0n (5)

Might I suggest adding spaces between the ends and beginning of the user's input perhaps? It kinda squishes it all together.

k4t3xpl0si0n (5)

@Bloxy_Cola Whenever a user types something in, the bot replies with (for example: ) "wow,pizzalooks like fun!"

amasad (1708)

Nice! Maybe have it loop so it doesn't exit? Ask a simple question like "what's on your mind?" to keep the user entertained 😂

dotcomboom (58)

@Bloxy_Cola
You can put it in a loop like this:

loop do
    puts 'Bot: Whats on your mind?'
    puts 'Bot: wow,' + gets.strip + 'looks like fun!'
end
Bloxy_Cola (15)

@dotcomboom Ok! Thats good! Thanks!
PS: how do you do that code text thing?

dotcomboom (58)

@Bloxy_Cola ah, you surround it with three backticks (`)