Share your repls and programming experiences

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

A chat bot I made in Ruby 2.5.0

k4t3xpl0si0n (6)

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

k4t3xpl0si0n (6)

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

amasad (3343)

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 (139)

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!'
Bloxy_Cola (16)

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

dotcomboom (139)

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