Syntax Question

 

Hello Everyone!,

I have a question about a syntax

A && B && C >= 10

is the same like this?

A>=10 && b>=10 && c>=10


I know is a newbie question, but i didn't find some information about it or some examples, i did some runnings but is not clearly.

Thanks in advance and sorry for it :( .


Regards

 
They are not the same.
  1. A && B && C >= 10

    Means A is true and B is true and C >= 10

  2. True = non-zero and false = zero so you get:

    if( 3 < 2 < 1 )
    if( false < 1 )
    if(     0 < 1 )
    if(     true  )
    if( 3 > 2 > 1 )
    iftrue > 1 )
    if(     1 > 1 )
    if(     false )
    

 
William Roeder:
They are not the same.
  1. Means A is true and B is true and C >= 10

  2. True = non-zero and false = zero so you get:

Hi William!,

Good to know thanks for your reply.

Is there a shortcode to do the same way ?, but shorter.

A>=10 && b>=10 && c>=10
 
MathMin( A, MathMin(b,c) ) >=10
Less efficient, less clear; you decided if it is shorter.
 
fdesu:

Hi William!,

Good to know thanks for your reply.

Is there a shortcode to do the same way ?, but shorter.

if ((A+b+c)>=30)
 

Nevermind guys thanks for your time!!, i think is alright.

Regards!

 
fdesu:
A>=10 && b>=10 && c>=10

Is there a shortcode to do the same way ?, but shorter.

Sardion Maranatha:
if ((A+b+c)>=30)

Wrong.

What if a = 30, b=1 and c=1 ?