ifthen_01.bmx 913 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. SuperStrict
  2. Local i:Int = 0
  3. If i = 0 Then
  4. If i <> 0 Then If i <> 3 Then Print i+" is not 1 or 2 or 3"
  5. Print "hmm"
  6. EndIf
  7. Local a:Int=1, b:Int =0
  8. If a Then Print "single line"
  9. If a Print "single line" Else Print "single line b"
  10. If a Then Print "a" Else If b Then Print "b" Else Print "not b"
  11. If b Then Print "not b" Else If Not a Then Print "not a" Else Print "a"
  12. If a If b Then Print "chained single line"
  13. If a If b
  14. Print "chained multi line"
  15. EndIf
  16. If a Then If b
  17. Print "chained multi line then"
  18. EndIf
  19. If a Then Print "single line then" Else Print "single line else"
  20. If b Then Else Print "single line skipped then"
  21. 'use variables, else compiler possibly "optimizes out" the if-thens
  22. Local c:Int = 1
  23. If c + 2 = 3
  24. Print "calculation ok"
  25. Else
  26. Print "cannot calculate"
  27. EndIf
  28. 'end check
  29. If 1 = 1 Then
  30. Print "hi"
  31. End
  32. Print "wont show"
  33. EndIf
  34. Function testme:int()
  35. EndFunction
  36. If Not testme() End