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

Username:   Password: 
 RegisterRegister   
 If statement not exectuing?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Tasty Pastry




PostPosted: Thu Jun 08, 2017 8:07 am   Post subject: If statement not exectuing?

I'm making a game in turing, and I have one part where the user is asked for an input by clicking the mouse. The program executes the part where the mouse is clicked, but doesn't execute the if statement after. Am I doing something wrong?
Turing:


loop
Mouse.Where (mousex,mousey,buttonpress)
 
if buttonpress=1 then
   if 480<mousex and mousex<585 then
      if 455>mousey and mousey>405 then
      girl := 1
      put "Girl"
end if
end if
end if
if buttonpress = 1 then
if 787<mousex and mousex<858 then
      if 447>mousey and mousey>410 then
      boy := 1
      put "Boy"
      end if
      end if
      end if
exit when girl = 1 or boy = 1
end loop

cls

if girl = 1 then
ReText
TypewriterPrint ("So I'm a girl...")
else if boy = 1 then
ReText
TypewriterPrint ("So I was right...")
end if
end if
ReText




Please specify what version of Turing you are using
<Answer Here>
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Thu Jun 08, 2017 8:37 am   Post subject: RE:If statement not exectuing?

There is a difference between 'elsif' and 'else if'. Make sure you're using the right one.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: