Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Is it possible to move an object with case statements?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
zOriginaL




PostPosted: Thu Apr 22, 2010 6:53 pm   Post subject: Is it possible to move an object with case statements?

If so, how?
Sponsor
Sponsor
Sponsor
sponsor
ProgrammingFun




PostPosted: Thu Apr 22, 2010 7:00 pm   Post subject: RE:Is it possible to move an object with case statements?

Please elaborate.

It may be possible but it depends on how and why you want it to move.
IMO, if statements are better for animation.

You should answer the questions in the template provided when you create a topic.
Insectoid




PostPosted: Thu Apr 22, 2010 7:10 pm   Post subject: RE:Is it possible to move an object with case statements?

Why would you want to?

Anyway, you could do it kind of like this:
code:

newLocation := case lastLocation
    label case1 : valueForCase1
    label case2: valueForCase2
end case
drawObject (newLocation)


No, I don't know the turing case syntax, but that's the gist of it. If statements are much better in my horribly uninformed and biased opinion.
Tony




PostPosted: Thu Apr 22, 2010 11:15 pm   Post subject: RE:Is it possible to move an object with case statements?

@Insectoid: you are thinking too much in Ruby. Turing's case does not return a value.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
SNIPERDUDE




PostPosted: Fri Apr 23, 2010 9:47 am   Post subject: RE:Is it possible to move an object with case statements?

In Turing, a case statement is just like a crippled if statement.
Insectoid




PostPosted: Fri Apr 23, 2010 5:04 pm   Post subject: RE:Is it possible to move an object with case statements?

If it doesn't return a value then how the hell do you use it? Is it only good for calling procedures or something?

@Sniperdude, I agree, though it has its uses.
ProgrammingFun




PostPosted: Fri Apr 23, 2010 5:19 pm   Post subject: Re: RE:Is it possible to move an object with case statements?

Insectoid @ Fri Apr 23, 2010 5:04 pm wrote:
If it doesn't return a value then how the hell do you use it? Is it only good for calling procedures or something?

@Sniperdude, I agree, though it has its uses.


Case statements (in Turing) let you do something like the following:
(You can also call procedures, I guess)

Turing:

var example:int
get example

case example of
label 1: put "You put 1."
label 2: put "You put 2."
label: put "You are boring!"
end case
Insectoid




PostPosted: Fri Apr 23, 2010 5:35 pm   Post subject: RE:Is it possible to move an object with case statements?

Oh, lame. Can you replace the 'put' with an assignment at least?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Apr 23, 2010 5:43 pm   Post subject: RE:Is it possible to move an object with case statements?

short: yes

long:
case
Quote:
case expn of
{ label compileTimeExpn {, compileTimeExpn } :
statementsAndDeclarations }
...
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: