Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: case when when
Martyn
11/12/2007 12:00:00 PM
when 5: , 9:
-----Original Message-----
From: list-bounce@example.com [mailto:list-bounce@example.com] On Behalf
Of Shuaib Zahda
Sent: 12 November 2007 11:38
To: ruby-talk ML
Subject: case when when
Hi all
I am just wondering how can we make two cases belong to the same bunch
of code. I tried to do it like c but it did not work. it is like this in
c
switch(x)
{
case 5:
#do bla bla
break;
case 7 : case 9:
#do bla bla
break;
default:
#bla
}
however, I tried to do the same way in ruby but it did not work.
case x
when 5:
#do bla
when 7: when 9:
#do bla bla
else
#bla
end
I know that when provides conditions and I can use them but I am just
wondering what is the way because i did not find it in books and online
regards
--
Posted via
http://www.ruby-...
.
This message has been scanned for viruses by MailController -
www.MailController.altohiway.com
Triteq Limited
'excellence in electronic design'
Tel: +44 (0) 1488 684554
Fax:+44(0) 1488 685335
Web: www.triteq.com/ www.triteq-medical.com
*Officially shortlisted for: 2007 Product Design Category IET Innovation in=
Engineering Award*
**Elektra 2006 Award Winners- Design Application of the Year*
**IDEA 2006 Awards Winners- Design Collaboration Award and Innovative Small=
Company Award*
***************************************************************************=
***************************************************************************=
****************
This is an e-mail from Triteq Limited and its contents (including all atta=
chments) and any files transmitted with it are confidential and intended so=
lely for the individual or entity to which it is addressed. It may not be =
copied or printed by anyone other than the addressee and may not be disclos=
ed or distributed in any way. If you have received this e-mail in error pl=
ease inform Triteq Limited and delete it from your mailbox or any other sto=
rage mechanism.=20
Please note that neither Triteq Limited nor the sender accepts any respons=
ibility for viruses and it is your responsibility to scan attachments (if a=
ny). No contracts may be concluded on behalf of Triteq Limited by means of=
e-mail communications. It is possible for data conveyed by e-mail to be d=
eliberately or accidentally intercepted or corrupted.=20=20
For this reason, in communicating solely by e-mail, Triteq Limited is unabl=
e to accept any responsibility for any breaches of confidence which may ari=
se through use of this medium.
Opinions, conclusions and other information expressed in this message are n=
ot given or endorsed by Triteq Limited unless otherwise indicated by an aut=
horised representative independent of this message.
ISO 9001 & ISO13485 Registered
Registered Office Number: 2757740
info@triteq.com
**************************************************************************=
***************************************************************************=
*****************
This message has been scanned for viruses by MailController.
1 Answer
Ken Bloom
11/12/2007 7:08:00 PM
0
Martyn <martyn.jago@triteq.com> wrote:
> when 5: , 9:
No.
case x
when 5:
#do blah
when 7,9:
#do blah blah
else
end
> -----Original Message-----
> From: list-bounce@example.com [mailto:list-bounce@example.com] On Behalf
> Of Shuaib Zahda
> Sent: 12 November 2007 11:38
> To: ruby-talk ML
> Subject: case when when
>
> Hi all
>
> I am just wondering how can we make two cases belong to the same bunch
> of code. I tried to do it like c but it did not work. it is like this in
> c
>
> switch(x)
> {
> case 5:
> #do bla bla
> break;
> case 7 : case 9:
> #do bla bla
> break;
> default:
> #bla
> }
>
> however, I tried to do the same way in ruby but it did not work.
> case x
> when 5:
> #do bla
> when 7: when 9:
> #do bla bla
> else
> #bla
> end
>
> I know that when provides conditions and I can use them but I am just
> wondering what is the way because i did not find it in books and online
>
> regards
> --
> Posted via
http://www.ruby-...
.
--
Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: case when when
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password