On 3/29/06, Jan_K <non / none.com> wrote:
[snip]
> I can't use "Until" because it wasn't covered in the book so far (even
> though it seems pretty straightforward what it does). Ditto for "+-"
>
> What was covered so far up until this chapter:
>
> if, else, elsif, while
>

Here's a very simplified example that I believe uses only what's been
covered up to that point.

last_input = ''
goodbye = 1

while goodbye < 3
  input = gets.chomp

  if input == input.upcase
    puts "NO, NOT SINCE " + (1930 + rand(21)).to_s
  else
    puts "HUH?!  SPEAK UP, SONNY!"
  end

  if input == 'BYE' and last_input == 'BYE'
    goodbye = goodbye + 1
  else
    goodbye = 1
  end

  last_input = input
end

--
Bill Guindon (aka aGorilla)
The best answer to most questions is "it depends".