School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,360 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,737 people online right now. Registration is fast and FREE... Join Now!




Syntax Error

 

Syntax Error

ShadowKyogre

19 Nov, 2008 - 02:50 PM
Post #1

New D.I.C Head
*

Joined: 11 Nov, 2008
Posts: 19

Okay...I put this in:

CODE
print "Is 3 = 4 or 8 > 2?"
print (3 = 4 || 8 > 2)


When it gets to "print (3 = 4 || 8 > 2)", it says syntax error. How do I fix this?

User is offlineProfile CardPM
+Quote Post


Martyr2

RE: Syntax Error

19 Nov, 2008 - 03:00 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 7,243



Thanked: 820 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Make it "3 == 4" and not "3 = 4". You are testing equality here, so you need the double equal signs. This is saying "is 3 equal to 4?" Obviously it is not, but since 8 is greater than 2, the whole thing is true. So the result is Is 3 = 4 or 8 > 2?true

smile.gif

This post has been edited by Martyr2: 19 Nov, 2008 - 03:01 PM
User is offlineProfile CardPM
+Quote Post

ShadowKyogre

RE: Syntax Error

19 Nov, 2008 - 03:02 PM
Post #3

New D.I.C Head
*

Joined: 11 Nov, 2008
Posts: 19

Oh...whoops! whatsthat.gif
Wait...even after I fixed that, it still gives me syntax error. As weird as this sounds, I'm using RPG Maker XP to test my Ruby... I don't know if it's RPGMXP or my language.

This post has been edited by ShadowKyogre: 19 Nov, 2008 - 03:04 PM
User is offlineProfile CardPM
+Quote Post

Martyr2

RE: Syntax Error

19 Nov, 2008 - 03:10 PM
Post #4

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 7,243



Thanked: 820 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Well it is the maker you are using because I know the fix to be correct and outputs exactly what I am showing you. Make sure that you have dumped any cached files it might be using and saving your change correctly. Sounds like you need a refresh somewhere.

smile.gif
User is offlineProfile CardPM
+Quote Post

ShadowKyogre

RE: Syntax Error

19 Nov, 2008 - 03:19 PM
Post #5

New D.I.C Head
*

Joined: 11 Nov, 2008
Posts: 19

Thinking...
Saving change correctly: Yes
Dump cached files: No....but how would I do that? I don't think I have any cached files since I haven't been saving my game each time I test a script.
User is offlineProfile CardPM
+Quote Post

ShadowKyogre

RE: Syntax Error

20 Nov, 2008 - 05:52 PM
Post #6

New D.I.C Head
*

Joined: 11 Nov, 2008
Posts: 19

Okay, I fixed it. Apparently, I had to change ! to != when comparing two values...the tut I was looking at did not make that clear.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 07:48PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month