Jump to content
  • 0

if(select(...


integral

Question


  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  167
  • Reputation:   4
  • Joined:  02/01/12
  • Last Seen:  

What's the difference between these two?

if(select("Yes:No") - 1)

if(select("Yes:No")== 1)

What's the - 1/ == 1 for?

Thank you.

Edited by integral
Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  392
  • Reputation:   285
  • Joined:  12/19/11
  • Last Seen:  

select returns the number of chosen option, starting with 1 (in this case it's 1 for Yes and 2 for No).

if clause is entered if the condition in it does not evealuate to 0, or is not false

== compares two expressions and returns true if they're equal

- 1 substracts 1 from the expression

So, first example, Yes will yield if-condition equal 0, so if clause will not be entered, and No will yield if-condition equal 1, so if clause will be entered.

In second example, you probably know already what will happen :)

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  167
  • Reputation:   4
  • Joined:  02/01/12
  • Last Seen:  

if clause is entered if the expression in it does not equal 0

Sorry, I wasn't able to get this part...

select returns the number of chosen option, starting with 1 (in this case it's 1 for Yes and 2 for No).

if clause is entered if the condition in it does not evealuate to 0, or is not false

== compares two expressions and returns true if they're equal

- 1 substracts 1 from the expression

So, first example, Yes will yield if-condition equal 0, so if clause will not be entered, and No will yield if-condition equal 1, so if clause will be entered.

In second example, you probably know already what will happen :)

Oh... I see, alright. Thank you. Problem Solved.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...