When an if case is true, it should run another if case

137 Views Asked by At

I'm programming in Xojo and I want my computer to first run an if case and if that case is true, it should run another if case. How can I do that with Xojo ?

2

There are 2 best solutions below

0
On

Below is an example of an If statement that includes the use of ElseIf and Else clauses:

Var theNumber As Double

If theNumber > 0 And theNumber < 100 Then
  MessageBox("The entered number is between 0 and 100")

ElseIf theNumber == 0 Or the number == 100 Then
  MessageBox("The entered number is either 0 or 100")

ElseIf theNumber < 0 Or theNumber > 100 Then
  MessageBox("The entered number is either below 0 or above 100")

Else
  MessageBox("Invalid input. Please try again...")
End If

0
On

Here's how to do it:

If condition = True Then
  // let's test the 2nd condition
  If secondCondition = True Then
    // do something
  Else
    // do something else
  End If
End If