ElseIf.htm 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>ElseIf</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. None
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. During a standard IF ... THEN conditional structure, you may wish to check another condition if the original condition fails. This 'nested IF' situation can get WAY out of hand, and once you have more than two nested conditionals, you should consider aSELECT/CASE structure. See the example.
  21. <br>
  22. <br>
  23. See also: <a class=small href=If.htm>If</a>, <a class=small href=Then.htm>Then</a>, <a class=small href=Else.htm>Else</a>, <a class=small href=ElseIf.htm>ElseIf</a>, <a class=small href=EndIf.htm>EndIf</a>, <a class=small href=Select.htm>Select</a>.
  24. </td>
  25. </tr>
  26. </table>
  27. <h1><a href=../2d_examples/ElseIf.bb>Example</a></h1>
  28. <table>
  29. <tr>
  30. <td>
  31. ; ELSEIF Example <br />
  32. <br />
  33. ; Input the user's name <br />
  34. name$=Input$("What is your name? ") <br />
  35. <br />
  36. ; Doesn't the person's name equal SHANE? <br />
  37. If name$ = "Shane" Then <br />
  38. Print "You are recognized, Shane! Welcome!" <br />
  39. <br />
  40. ElseIf name$="Ron" Then <br />
  41. Print "You are recognized too, Ron! Welcome!" <br />
  42. <br />
  43. Else <br />
  44. Print "Sorry, you don't belong here!" <br />
  45. <br />
  46. ; End of the condition checking <br />
  47. End If
  48. </td>
  49. </tr>
  50. </table>
  51. <br>
  52. <a target=_top href=../index.htm>Index</a><br>
  53. <br>
  54. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=ElseIf&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  55. </html>