Tamiris Ayasli
Tamiris Ayasli

Reputation: 9

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

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 ?

Upvotes: 0

Views: 140

Answers (2)

dda
dda

Reputation: 6203

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

Upvotes: 0

Patrick Cyubahiro
Patrick Cyubahiro

Reputation: 109

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

Upvotes: 0

Related Questions