Jump to content

if $ then go to section1


Recommended Posts

Guest Guest_LoneReaper
Posted

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?

Posted

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.

Posted

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

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
×
×
  • Create New...