News:

FOR INFORMATION ON DONATIONS, AND HOW TO OBTAIN ACCESS TO THE GAME, PLEASE VIEW THE FOLLOWING TOPIC: http://stick-online.com/boards/index.php?topic=2.0

Main Menu

if statement

Started by ARTgames, September 24, 2009, 06:10:46 PM

Previous topic - Next topic

Mr Pwnage

#15
Well Art what point are you trying to get at? What is the point of having more than one number represent true/false? I guess I don't see what you getting at. Regardless, if you are trying to learn more about if statements, look up: the "Boolean" data structure. It is pretty much a way to represent comparisons of data and than display them as a true or false output. If you have something else that needs being answered, please take some time to spell check it and make it legible so we can understand where your getting at with this topic, as I have no idea what your trying to understand, thanks.
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones." -Albert Einstein (1947)

http://www.benmward.com/projects.php

Lingus

If you look back at the wiki article and review it more thoroughly it will give you the answer to your question. Specifically, go under the section titled "Boolean types and operations in modern languages" and find the language you are looking for. It will have a little bit about Boolean types in that language and how it works. For instance under C++:
QuoteValues of type bool are either true or false.[5] Implicit conversions exist between bool and other integral types, floating point types, pointer types, and pointer-to-member types.[6] In addition, user-defined types can be converted to bool via a user-defined conversion operator. In general, a zero or null-pointer value is converted to false, any other value is converted to true.
And btw, Joel, this actually proves you wrong. The reason why -1 works as true (I know I said false) in this case is because it is a non-zero value. So you could use any number besides zero and it would convert to true.

ARTgames

Quote from: JoEL on September 24, 2009, 11:05:04 PM
btw, about the "java doesn't work with negetive numbers as well"

I don't think that's true, GM defenatly can work with negative numbers, if you ask for example:

if ( -20 < -10)
{
show_message('-20 is lower then -10')
}

now that's working with negative numbers, I'm not 100% if that works like that, you may have to set the negative's as variables...

>_< no! if (-1) in java not if (-1<-2)....

@Mr Pwnage  read http://www.stick-online.com/boards/index.php?topic=337.msg5783#msg5783 You seem to be the only one having problems with my writing in this topic also. im not saying its good (my writing) but other people seem to understand it well. :/

@Lingus mmmk. as i said i did not look threw it well. But the quote you pulled out was wast i was looking for. Thank you

Lingus

Quote from: ARTgames on September 25, 2009, 05:18:12 PM
@Mr Pwnage  read http://www.stick-online.com/boards/index.php?topic=337.msg5783#msg5783 You seem to be the only one having problems with my writing in this topic also. im not saying its good (my writing) but other people seem to understand it well. :/

@Lingus mmmk. as i said i did not look threw it well. But the quote you pulled out was wast i was looking for. Thank you
Yea, that was just one of the languages on that page. There's around 20 or so.

As far as understanding your writing, it's not that you need to spell check like Pwnage said. It wouldn't hurt, but spelling/grammar is not the reason why someone might misunderstand you. So his advice was misplaced. What I have trouble sometimes is in the logic of your statements. I will assume you are talking about one thing because of your phrasing, but you were actually talking about something else. It took me a post or two to realize what you were talking about here... But after that I get it. No big deal.

ARTgames

Quote from: Lingus on September 25, 2009, 08:22:09 PM
As far as understanding your writing, it's not that you need to spell check like Pwnage said. It wouldn't hurt, but spelling/grammar is not the reason why someone might misunderstand you. So his advice was misplaced. What I have trouble sometimes is in the logic of your statements. I will assume you are talking about one thing because of your phrasing, but you were actually talking about something else. It took me a post or two to realize what you were talking about here... But after that I get it. No big deal.

I agree with that. But in my posts i do try to make them readable. any way in most of posts you will see the "edit" in the bottom in the small found. im not a good writer at all.

JoEL

Quote from: ARTgames on September 25, 2009, 05:18:12 PM
Quote from: JoEL on September 24, 2009, 11:05:04 PM
btw, about the "java doesn't work with negetive numbers as well"

I don't think that's true, GM defenatly can work with negative numbers, if you ask for example:

if ( -20 < -10)
{
show_message('-20 is lower then -10')
}

now that's working with negative numbers, I'm not 100% if that works like that, you may have to set the negative's as variables...

>_< no! if (-1) in java not if (-1<-2)....

You would never use if (-1) though....this seems like a ridiculous question now that I think about it...I don't see how this would fit into any program, why would you test if (-1) was true or false ?

ARTgames

I wouldn't. >_< I would use other stuff in conjunction with it and have the possibility of "-1" as a chance. I just simplified it to "-1" as the ending results the if statement hast to take care of. 

like "if ( abs( a - 1) )" can be used for a xor. And can be a helpful tick in vary simple languages or in a competition. or just simply to find new ways to do something to help find out ware a problem you might be having is in your program.

i explained this in my 3ed post in this topic. http://www.stick-online.com/boards/index.php?topic=337.msg5767#msg5767

JoEL

Yeah, but we come back to the problem where you aren't very good at explaining things...but at least in the end you got your answer. Congratulations, oh and I learnt something ;)

ARTgames

help me and tell me what part you dont understand. I need to work on this.

Lingus

Actually, if(x) is a valid test. You're checking whether x converts to true or false. If it's zero or null it will be false. If anything else it's true. So saying if(-1) is the same thing.

Mr Pwnage

So just for clarification...are you really just messing around with the syntax of various languages? Seeing if they can be written multiple ways? I am so lost right now.
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones." -Albert Einstein (1947)

http://www.benmward.com/projects.php

ARTgames

Quote from: Lingus on September 26, 2009, 06:50:48 PM
Actually, if(x) is a valid test. You're checking whether x converts to true or false. If it's zero or null it will be false. If anything else it's true. So saying if(-1) is the same thing.

what? who were you talking to?

@Mr Pwnage
it really does not matter any more. ling and other people have helped me.

Lingus

Quote from: ARTgames on September 26, 2009, 08:45:10 PM
Quote from: Lingus on September 26, 2009, 06:50:48 PM
Actually, if(x) is a valid test. You're checking whether x converts to true or false. If it's zero or null it will be false. If anything else it's true. So saying if(-1) is the same thing.

what? who were you talking to?
Joel. It was in response to this:

Quote from: JoEL on September 26, 2009, 05:28:49 AM
You would never use if (-1) though....this seems like a ridiculous question now that I think about it...I don't see how this would fit into any program, why would you test if (-1) was true or false ?