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

Username:   Password: 
 RegisterRegister   
 procedure and else if statements
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
sci23




PostPosted: Thu Dec 20, 2007 4:26 pm   Post subject: procedure and else if statements

when i run this there is an error. how do i put else if statements in procedures? thanks for your help
code:


procedure die
if die=die1 then
drawbox(300,50,200,150,7)
drawfilloval(250,100,10,10,7)
elsif
 die=die2 then
drawbox(300,50,200,150,7)
drawfilloval(285,135,10,10,7)
drawfilloval(215,65,10,10,7)
elsif
die=die3 then
drawbox(300,50,200,150,7)
drawfilloval(285,135,10,10,7)
drawfilloval(215,65,10,10,7)
drawfilloval(250,100,10,10,7)
elsif
die=die4 then
drawbox(300,50,200,150,7)
drawfilloval(285,135,10,10,7)
drawfilloval(215,65,10,10,7)
drawfilloval(285,65,10,10,7)
drawfilloval(215,135,10,10,7)
elsif
die=die5 then
drawbox(300,50,200,150,7)
drawfilloval(285,135,10,10,7)
drawfilloval(215,65,10,10,7)
drawfilloval(285,65,10,10,7)
drawfilloval(215,135,10,10,7)
drawfilloval(250,100,10,10,7)
elsif
die=die6 then
drawbox(300,50,200,150,7)
drawfilloval(285,135,10,10,7)
drawfilloval(215,65,10,10,7)
drawfilloval(285,65,10,10,7)
drawfilloval(215,135,10,10,7)
drawfilloval(215,100,10,10,7)
drawfilloval(285,100,10,10,7)
end if
end die

put "Rolled ", Rand.Int (die,1, 6)
Sponsor
Sponsor
Sponsor
sponsor
Saad




PostPosted: Thu Dec 20, 2007 5:07 pm   Post subject: RE:procedure and else if statements

What exactly are you trying to do?, as far as i know, you cant check if procedures are equal (Why would you anyway?)
Jestar




PostPosted: Thu Dec 20, 2007 5:41 pm   Post subject: Re: procedure and else if statements

i would just make a different procedure for each die roll and call the procedure when it has the correct die roll.
Clayton




PostPosted: Thu Dec 20, 2007 6:11 pm   Post subject: RE:procedure and else if statements

Why not create one procedure which takes a parameter for which value the die has been rolled?
Jestar




PostPosted: Thu Dec 20, 2007 8:11 pm   Post subject: Re: procedure and else if statements

that works to Very Happy
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  [ 5 Posts ]
Jump to:   


Style:  
Search: