Ruby Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesRuby Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 30th, 2010, 07:09 PM
andrewbriscoe87 andrewbriscoe87 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2010
Posts: 1 andrewbriscoe87 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 m 49 sec
Reputation Power: 0
Smile Hello everyone! + tiny question with case statement

Hi everyone,
I join this community in the spirit that hopefully I can help (at least where I can) and learn. I feel a bit like a noob not knowing the actual formalities when joining a forum such as this but basically I started learning ruby this semester and I have found it strangely addictive.

Oh, with the tiny question...

I have a script that is basically as such:
#used to readjust dates when months are days are added to it

def function(x,y,z)
valid = false
until var == true
case z
when 1
#do something
when 2
#do something
else
var = true
end
end

The point I am really trying to get across is:
when the 'when' is satisfied, does it go to the next 'when' then 'else'

If it is appropriate I can post the code... it isn't excessive in length.
Any thoughts or input would be appreciated.

[edit] Apologies all, just my logic playing tricks on me

Last edited by andrewbriscoe87 : September 30th, 2010 at 07:45 PM. Reason: solved the tiny question

Reply With Quote
  #2  
Old October 16th, 2010, 03:49 AM
patrick99e99 patrick99e99 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Location: los angeles
Posts: 5 patrick99e99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 47 sec
Reputation Power: 0
Send a message via AIM to patrick99e99 Send a message via Yahoo to patrick99e99
This should clear things up:

PHP Code:
 x "cat"

case x
when 
"cat"
  "meow"
when "dog"
  "woof"
else
  
"unknown animal"
end

# or

case
when x == "cat" then "meow"
when y == "zebra" then "stripes"
else
  
"wtf?"
end 

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesRuby Programming > Hello everyone! + tiny question with case statement

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap