diff options
author | Gregory Brown <gregory.t.brown@gmail.com> | 2009-02-02 11:59:04 -0500 |
---|---|---|
committer | Gregory Brown <gregory.t.brown@gmail.com> | 2009-02-02 11:59:04 -0500 |
commit | 6ff9ffe5fabf766183db9ed1d548b70e21f02eb6 (patch) | |
tree | 19a69d22f4c15a7ec1dfb69988f2fa51365b08fe /examples/asking_for_arrays.rb | |
parent | 37cd9cff1783911ab51afd90ba6588ce12c58b57 (diff) | |
download | highline-6ff9ffe5fabf766183db9ed1d548b70e21f02eb6.tar.gz |
restructuring
Diffstat (limited to 'examples/asking_for_arrays.rb')
-rw-r--r-- | examples/asking_for_arrays.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/asking_for_arrays.rb b/examples/asking_for_arrays.rb new file mode 100644 index 0000000..6c62a0e --- /dev/null +++ b/examples/asking_for_arrays.rb @@ -0,0 +1,18 @@ +#!/usr/local/bin/ruby -w + +# asking_for_arrays.rb +# +# Created by James Edward Gray II on 2005-07-05. +# Copyright 2005 Gray Productions. All rights reserved. + +require "rubygems" +require "highline/import" +require "pp" + +grades = ask( "Enter test scores (or a blank line to quit):", + lambda { |ans| ans =~ /^-?\d+$/ ? Integer(ans) : ans} ) do |q| + q.gather = "" +end + +say("Grades:") +pp grades |