Else If.htm 1.4 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>Else If</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 a SELECT/CASE structure. See the example.
  21. <br>
  22. <br>
  23. See also: <a class=small href=ElseIf.htm>ElseIf</a>.
  24. </td>
  25. </tr>
  26. </table>
  27. <h1><a href=../2d_examples/Else If.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=Else If&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  55. </html>