Created
March 13, 2014 20:55
-
-
Save alebaffa/9536826 to your computer and use it in GitHub Desktop.
Week 5 - Challange 1. Implement a very simple REPL for Ruby.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# simple_repl.rb | |
# This program replicate a very simple REPL for Ruby. | |
def prompt | |
print '>>' | |
user_input = gets.chomp! | |
puts("=> #{eval(user_input)}") | |
end | |
loop do | |
prompt | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment