File: asking_for_arrays.rb

package info (click to toggle)
ruby-highline 1.6.13-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 616 kB
  • sloc: ruby: 4,657; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 398 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env ruby

# 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