Mintoris Forum

Author Topic: If Then Else?  (Read 3143 times)

agrad

  • Jr. Member
  • **
  • Posts: 4
If Then Else?
« on: Jun 22, 2013, 09:02 PM »
Can someone tell me what is the best Mintoris Basic equivalent for the old Basic If Then Else statement? I tried using Else after If Then and get an error message.

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: If Then Else?
« Reply #1 on: Jun 22, 2013, 09:04 PM »
You have to put the Else on a new line.

if true then
  … Do something
else
  … Do something else
endif

agrad

  • Jr. Member
  • **
  • Posts: 4
Re: If Then Else?
« Reply #2 on: Jun 22, 2013, 09:30 PM »
Thank you for the help and quick reply. I love this app.

agrad

  • Jr. Member
  • **
  • Posts: 4
Re: If Then Else?
« Reply #3 on: Jun 22, 2013, 09:56 PM »
I am still getting error messages Expecting end of line and Else not matched up with If Then

If B = 4 Then Print "Correct"
Else Print "Incorrect"
Endif

Chuck

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1899
Re: If Then Else?
« Reply #4 on: Jun 22, 2013, 10:11 PM »
A compound if is defined as an if with a Then at the end of the line (not followed by anything). You have to put each command on a separate line.

If B = 4 Then
  Print "Correct"
Else
  Print "Incorrect"
Endif

agrad

  • Jr. Member
  • **
  • Posts: 4
Re: If Then Else?
« Reply #5 on: Jun 22, 2013, 10:13 PM »
Thanks again.