ifthen_01.bmx 939 B

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