Sign in to follow this  
Followers 0
Guest Guest_LoneReaper

if $ then go to section1

4 posts in this topic

I have an if statement and if its true i want it to go to a section of the script and if not go to another section. what is that called?

Share this post


Link to post
Share on other sites



you can do a really big if statement and it would work.. but I think maybe this is where Select.. case.. endselect could be used?

Share this post


Link to post
Share on other sites

There are several ways to accomplish this, and each has advantages depending on the rest of your code.

Method 1: If-Else

If <CONDITION> Then
   ;do your "true" code here
Else
   ;do your "false" code here
EndIf

Method 2: Select-Case

Select
  Case <CONDITION>
     ;do your "true" code here
  Case Else
     ;do your "false" code here
EndSelect

Method 3: Functions

If <CONDITION> Then
  TrueFunction()
Else
  FalseFunction()
EndIf

;rest of your script goes here as required

Func TrueFunction()
   ;do your "true" code here
EndFunc

Func FalseFunction()
   ;do your "false" code here
EndFunc

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

If $variable = 1 Then
MsgBox(0, "My Message", "$variable = 1!")
Else
MsgBox(0, "My Message", "$variable != 1!")
EndIf

Of course replace condition with desired condition, and same thing with what's in the if statement. :D


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0