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-forum.com/.
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 attachments) and any files transmitted with it are confidential and intended solely 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 disclosed or distributed in any way. If you have received this e-mail in error please inform Triteq Limited and delete it from your mailbox or any other storage mechanism.
Please note that neither Triteq Limited nor the sender accepts any responsibility for viruses and it is your responsibility to scan attachments (if any). 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 deliberately or accidentally intercepted or corrupted.
For this reason, in communicating solely by e-mail, Triteq Limited is unable to accept any responsibility for any breaches of confidence which may arise through use of this medium.
Opinions, conclusions and other information expressed in this message are not given or endorsed by Triteq Limited unless otherwise indicated by an authorised 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.