Was User errorRE: Beginner Qn - Syntax error with STDIN.gets

Sorry for this - the problem was the line currentUser++

···

-----Original Message-----
From: Booth, Peter
Sent: Sunday, October 20, 2002 6:15 PM
To: ruby-talk@ruby-lang.org
Subject: Beginner Qn - Syntax error with STDIN.gets

Can anyone tell me why I get a syntax error on the line

containing buf = STDIN.gets below?

Is there a ruby interpreter option that gives more detail on

syntax errors?

Peter Booth

require ‘net/http’

intHostname = “myhost”

intPort=18000

intPath="/home/"

uids = IO.readlines(“uids”)

currentUser = 0;

while true

        puts "How many users to add?"

        buf=""

        buf = STDIN.gets 

        

        newUsers = buf.to_i

        

        for i in 0...newUsers

                    uid = uids[currentUser]



                    headers = Hash.new

                    headers["Proxy-Remote-User"] = uid



                    h = Net::HTTP.new(intHostname,18000)

                    puts "Fetching page for user #{uid} count

#{currentUser}"

                    resp, data = h.get(intPath, headers)

                    puts "Got page for user #uid}: #{resp.message}"

                    currentUser++

        end

end

There is no ++ operator in Ruby – use currentUser += 1 instead.

-austin
– Austin Ziegler, austin@halostatue.ca on 2002.10.20 at 18.38.04

Hi,

It is item 9 in the Ruby newcomers list:

http://www.glue.umd.edu/~billtj/ruby.html#Pre/Post%20Increment/Decrement%20Operators

Regards,

Bill

···

=========================================================================
Booth, Peter Peter.Booth@gs.com wrote:

Sorry for this - the problem was the line currentUser++