PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > Slightly odd Integer() behavior
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Slightly odd Integer() behavior

Réponse
 
LinkBack Outils de la discussion
Vieux 03/12/2007, 19h59   #1
Lorenzo E. Danielsson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Slightly odd Integer() behavior

Integer(gets), works well if you enter any integer apart from 0, which
complains about "0\n" not being a valid integer. As expected,
Integer(gets.chomp) works for all integers, including 0.

Is it just me, or is this a tad bit weird? If it is not weird, then I
assume that I am weird for thinking it is weird so could somebody please
enlighten me on the source of my weirdness?

All this is happening on Ruby 1.8.6 running on an Etch/Lenny/Sid combo,
which I assume has nothing to do with the issue at hand.

Lorenzo


  Réponse avec citation
Vieux 03/12/2007, 20h11   #2
Wolfgang Nádasi-Donner
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Slightly odd Integer() behavior

Lorenzo E. Danielsson wrote:
> Integer(gets), works well if you enter any integer apart from 0, which
> complains about "0\n" not being a valid integer. As expected,
> Integer(gets.chomp) works for all integers, including 0.


For me (Windows2000) it works well for Ruby 1.8.6, but not for nightly
snapshot of Ruby 1.9...

>type putsgets.rb

puts Integer(gets)
puts Integer(gets)
>ruby -v

ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]

>ruby putsgets.rb

5
5
0
0

>ruby19 -v

ruby 1.9.0 (2007-12-02 patchlevel 0) [i386-mingw32]

>ruby19 putsgets.rb

5
5
0
putsgets.rb:2:in `Integer': invalid value for Integer: "0\n"
(ArgumentError)
from putsgets.rb:2:in `<main>'

I'll post this in ruby-core because it looks strange.
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 04/12/2007, 12h26   #3
Rosaura Barrile
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Eliminar / Unsubscribe

Lo mismo digo!!!

=20

From: Felipe Morales [mailto:jfmorales@hotmail.com]=20
Sent: martes, 04 de diciembre de 2007 08:54 a.m.
To: ruby-talk ML
Subject: Eliminar envio de correo a mi direccion

=20

Mis Saludos, por favor entre en la pagina ruby para que me enviaran
informacion referente al producto, pero el servidor me envia los =
comentarios
de todos y me estan llenando el correo, me di de baja pero no resulta si =
me
puedes orientar por favor. gracias





Juan Felipe Morales

mailto:jfmorales@hotmail.com


_____ =20


From: "Lorenzo E. Danielsson" <danielsson.lorenzo@gmail.com>
Reply-To: ruby-talk@ruby-lang.org
To: ruby-talk@ruby-lang.org (ruby-talk ML)
Subject: Slightly odd Integer() behavior
Date: Tue, 4 Dec 2007 04:59:52 +0900
MIME-Version: 1.0
Received: from carbon.ruby-lang.org ([221.186.184.68]) by
bay0-mc3-f11.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); =
Mon, 3
Dec 2007 12:04:07 -0800
Received: from carbon.ruby-lang.org (beryllium.ruby-lang.org =
[127.0.0.1])by
carbon.ruby-lang.org (Postfix) with ESMTP id 19BC33C2294B8;Tue, 4 Dec =
2007
05:00:29 +0900 (JST)
Received: from ug-out-1314.google.com (ug-out-1314.google.com
[66.249.92.169])by carbon.ruby-lang.org (Postfix) with ESMTP id
924DF3C229459for <ruby-talk@ruby-lang.org>; Tue, 4 Dec 2007 04:59:48 =
+0900
(JST)
Received: by ug-out-1314.google.com with SMTP id z38so2429212ugc for
<ruby-talk@ruby-lang.org>; Mon, 03 Dec 2007 11:59:50 -0800 (PST)
Received: by 10.78.149.15 with SMTP id w15mr4442581hud.1196711989385; =
Mon,
03 Dec 2007 11:59:49 -0800 (PST)
Received: from ?192.168.0.225? ( [41.211.0.141]) by mx.google.com with
ESMTPS id 2sm1006391nfv.2007.12.03.11.59.42 (version=3DSSLv3 =
cipher=3DRC4-MD5);
Mon, 03 Dec 2007 11:59:49 -0800 (PST)
>Integer(gets), works well if you enter any integer apart from 0, which
>complains about "0\n" not being a valid integer. As expected,
>Integer(gets.chomp) works for all integers, including 0.
>
>Is it just me, or is this a tad bit weird? If it is not weird, then I
>assume that I am weird for thinking it is weird so could somebody =

please
>enlighten me on the source of my weirdness?
>
>All this is happening on Ruby 1.8.6 running on an Etch/Lenny/Sid combo,
>which I assume has nothing to do with the issue at hand.
>
>Lorenzo
>
>





_____ =20

Consigue aqu=ED las mejores y mas recientes ofertas de trabajo en =
Am=E9rica
Latina y USA: Haz clic aqu=ED <http://g.msn.com/8HMAES/2734??PS=3D47575> =
=20


  Réponse avec citation
Vieux 04/12/2007, 12h59   #4
gmail
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Eliminar / Unsubscribe

habeis probado de enviar un email a ruby-talk-ctl@ruby-lang.org
que ponga "unsubscribe" en el cuerpo.

Soma

2007/12/4, Rosaura Barrile <rbarrile@b-vision.com>:
>
> Lo mismo digo!!!
>
>
>
> From: Felipe Morales [mailto:jfmorales@hotmail.com]
> Sent: martes, 04 de diciembre de 2007 08:54 a.m.
> To: ruby-talk ML
> Subject: Eliminar envio de correo a mi direccion
>
>
>
> Mis Saludos, por favor entre en la pagina ruby para que me enviaran
> informacion referente al producto, pero el servidor me envia los
> comentarios
> de todos y me estan llenando el correo, me di de baja pero no resulta si
> me
> puedes orientar por favor. gracias
>
>
>
>
>
> Juan Felipe Morales
>
> mailto:jfmorales@hotmail.com
>
>
> _____
>
>
> From: "Lorenzo E. Danielsson" <danielsson.lorenzo@gmail.com>
> Reply-To: ruby-talk@ruby-lang.org
> To: ruby-talk@ruby-lang.org (ruby-talk ML)
> Subject: Slightly odd Integer() behavior
> Date: Tue, 4 Dec 2007 04:59:52 +0900
> MIME-Version: 1.0
> Received: from carbon.ruby-lang.org ([221.186.184.68]) by
> bay0-mc3-f11.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Mon,
> 3
> Dec 2007 12:04:07 -0800
> Received: from carbon.ruby-lang.org (beryllium.ruby-lang.org [127.0.0.1
> ])by
> carbon.ruby-lang.org (Postfix) with ESMTP id 19BC33C2294B8;Tue, 4 Dec 200=

7
> 05:00:29 +0900 (JST)
> Received: from ug-out-1314.google.com (ug-out-1314.google.com
> [66.249.92.169])by carbon.ruby-lang.org (Postfix) with ESMTP id
> 924DF3C229459for <ruby-talk@ruby-lang.org>; Tue, 4 Dec 2007 04:59:48 +090=

0
> (JST)
> Received: by ug-out-1314.google.com with SMTP id z38so2429212ugc for
> <ruby-talk@ruby-lang.org>; Mon, 03 Dec 2007 11:59:50 -0800 (PST)
> Received: by 10.78.149.15 with SMTP id w15mr4442581hud.1196711989385; Mon=

,
> 03 Dec 2007 11:59:49 -0800 (PST)
> Received: from ?192.168.0.225? ( [41.211.0.141]) by mx.google.com with
> ESMTPS id 2sm1006391nfv.2007.12.03.11.59.42 (version=3DSSLv3
> cipher=3DRC4-MD5);
> Mon, 03 Dec 2007 11:59:49 -0800 (PST)
> >Integer(gets), works well if you enter any integer apart from 0, which
> >complains about "0\n" not being a valid integer. As expected,
> >Integer(gets.chomp) works for all integers, including 0.
> >
> >Is it just me, or is this a tad bit weird? If it is not weird, then I
> >assume that I am weird for thinking it is weird so could somebody please
> >enlighten me on the source of my weirdness?
> >
> >All this is happening on Ruby 1.8.6 running on an Etch/Lenny/Sid combo,
> >which I assume has nothing to do with the issue at hand.
> >
> >Lorenzo
> >
> >

>
>
>
>
> _____
>
> Consigue aqu=ED las mejores y mas recientes ofertas de trabajo en Am=E9ri=

ca
> Latina y USA: Haz clic aqu=ED <http://g.msn.com/8HMAES/2734??PS=3D47575>
>
>


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 10h52.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,16457 seconds with 12 queries