User Tools

Site Tools


fb_controls

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
fb_controls [2022/12/03 23:38] praetorfb_controls [2022/12/04 01:27] (current) – [Bitwise Operators] praetor
Line 2: Line 2:
 Control structures are statements that modify the running state of your program - that is, they turn your program into a **state machine** and allows it to perform logical decisions. Your program can be in a different state depending on various conditions. For instance, **if** you're hungry **then** you are empty, but if you eat, you are full. **Or** if you're **not** hungry or empty, then you are something else that is not defined. Notice how the state can change depending on the conditions that are set. We call these **conditionals** and they impart intelligent logic into our programs. Control structures are statements that modify the running state of your program - that is, they turn your program into a **state machine** and allows it to perform logical decisions. Your program can be in a different state depending on various conditions. For instance, **if** you're hungry **then** you are empty, but if you eat, you are full. **Or** if you're **not** hungry or empty, then you are something else that is not defined. Notice how the state can change depending on the conditions that are set. We call these **conditionals** and they impart intelligent logic into our programs.
  
-In FreeBASIC, as well as other programming languages, there are two types of control structures.+In FreeBASIC, as well as other programming languages, there are three types of control structures.
  
   * Decision Making Structures - makes a series of decisions using **if,then,else** statements   * Decision Making Structures - makes a series of decisions using **if,then,else** statements
Line 27: Line 27:
 | >= | Greater than or equal to | | >= | Greater than or equal to |
  
-==== Bitwise Operators ====+===== Bitwise Operators =====
 ^Operator^ ^Operator^
 | AND | | AND |
Line 62: Line 62:
  
 <code freebasic> <code freebasic>
-input "What if your name? ",myName+input "What is your name? ",myName
 </code> </code>
 //input// is a new keyword that asks the user for input and stores it in a variable, myName in this case. //input// is a new keyword that asks the user for input and stores it in a variable, myName in this case.
Line 70: Line 70:
   print "Ave Praetor!"   print "Ave Praetor!"
 </code> </code>
-**if** myName is "Praetor" then, perform some function. In this case, print "Ave Praetor" to the screen+**if** myName is "Praetor" **then**, perform some function. In this case, print "Ave Praetor" to the screen
  
 <code freebasic> <code freebasic>
fb_controls.1670110727.txt.gz · Last modified: 2022/12/03 23:38 by praetor