The IF-THEN-ELSE statement is called growing up as children (even some adults) are programmed into becoming human beings. This is a computer statement which involves true-false logic just like real life.Even the smallest child quickly learns the logic of this programming statement.
IF it’s true you do something wrong THEN there will be consequences ELSE it’s false you did not do anything wrong there will be different consequences, END IF.
IF you put that ice cream in your mouth THEN
you’re gonna be in big trouble young man{if TRUE something happens}
ELSE
you will not be in trouble{if FALSE, something else will happen}
ENDIF
In our first program, we entered to numbers, guessed at the answer and we will use the If-Then statement to test the results with the correct answer.
INPUT:Num1 = First numbered inputted
Num2 = Second number inputted
Ans = Our guess for the correct answer
PROCESS:
Corr = Num1 * Num2
IF Ans = Corr THEN
PRINT “ You are correct”
ELSE
PRINT ”You’re a Moron”
END IF
Family Guy - I Want Ice Cream posted by huluDotCom.
Mine! Mine! Mine! It’s my stuff.Infants and even seagulls intuitively learn how to count by tracking and accounting for their stuff.Arithmetic was invented to keep track of stuff.
Children are delighted when they increase or add to their stuff.It is no wonder addition was the first arithmetic operation to be created.In QBasic the addition symbol is “+”
Children are sad when they have to give up or subtract their stuff.In QBasic the subtraction symbol is “-“.
Happy days are here again when children learn multiplication is a form of accelerated addition. In QBasic the “*” is the symbol for multiplication.
Another sad event is when we have to give up or divide stuff.Think of multiplication in reverse.
In QBasic the “/” is the symbol for multiplication.
Examples of QBasic arithmetic would be:
Num1 + Num2 = Ans1
Ans – Corr = Diff1
Num 1 * Num2 = Prod1
Prod1 / Num2 = Quot1
These are the four basic arithmetic operators in QBasic.
Mine mine mine (Finding Nemo) posted by as0k
George Carlin Talks About "Stuff" posted by CappyNJ
The number family is large a collection of numbers, actually an infinite collection numbers.Some numbersare prime while the majority are composites of other numbers.Every family has it’s negative members but they are usually offset by the positive members. There is only one zero in the family it is neither negative or positive.
The earliest numbers were simple whole counting numbers. Some people call them the natural numbers but there was nothing natural about zero which didn’t come into use in Western mathematics until about 1200 AD.Are the un-natural numbers zombie numbers, vampire numbers or invisible numbers?
The un-natural numbers are a little complicated to conceptualize. They are real numbers and can be very rational at times and irrational at other times. Integers are whole numbers which can be positive, negative or zero.(In QBasic we can define variables as integer numbers.)
Rational numbers are really ratio-nal numbers because they can be expressed as a ratio of integers and do not have a denominator of zero, ¼, 7/27, or 5/1.Rational number can also be divided and expressed as decimals although some quotients result in very annoying repeating decimals which go repeating for infinity and beyond but are predictable. (In QBasic we define non-integer numeric variables as floating numbers.)
Most disturbing are the irrational numbers.The most famous irrational number is pi or for really hungry people, pie.Pi is a mathematical constant of the ratio of a circle’s circumference to its diameter. The quotients of irrational numbers do not repeat but go on forever and ever like fairy tales.
The discovery of irrational numbers was not a fairy tale.The Greek philosopher Hippasus is believed to have discovered irrational numbers in the 5th century BC when tying to compute the square root of the number two.Pythagoras (yes, from the famous theorem a^2+b^2=c^2 where “^” is exponentiation in QBasic) and his Pythagorean School did not believe in irrational numbers.Rumor has the Godfather of the Pythagorean gang was very upset with Hippasus who ended up sleeping with the fishes.
There is a conspiracy theory Hippasus was drowned in the ocean for revealing the existence of irrational numbers.When programming in computers, keep your mind open for all possibilities. Some people believe Humpty Dumpty did not fall off the wall, he was pushed.
“The Godfather - Luca Brasi Sleeps with the Fishes” - Posted by TheFilmSpectrum.
“Humpty dumpty was pushed” – Posted by FAproduckshins
Every school age kid is an expert at the input statement.The most familiar input statement in the world is the Google search box.INPUT the string (characters) you want to search then press enter.The same is true for YouTube and other search engines.It wasn’t always this easy to get input or data in to computers.
In the old days, image if you had to handwrite your internet search request to Google unto a special columnar input coding sheet.Then you would have to give this sheet to a keypunch person who would use a keypunch machine to physically punch holes in a punch card.They would give you back a report with the punched card of what they keypunched.After you very carefully reviewed this, if correct, you would give it to a computer operator who would run your card through a computer punch card reader.Depending on the jobs running on the system, maybe in about an hour or two possibly the next day, you would receive a report of Google search findings.
We have evolved from punch cards, to keyboards, to a mice, optical recognition, to slide and touch and even voice activated input.
Below is a video of an ancient keypunch machine posted by ct1401:
Below is the sounds of a punch card reader created in Minecraft posted by ohmgane3sha:
In our programming, input is simple. Ask what you want and assign the input to a predefined variable.
INPUT “Let’s multiply, what is your name”; Name
INPUT “Enter a whole number”; Num1
INPUT “Enter another whole number”; Num2
INPUT “What is the product of these two numbers”; Ans
“A keyboard, how quaint” as Scotty from the future tries to use one, posted by movieclips:
Most people are familiar with Roman numeral counting such as I, II, III, IV, V… representing our number of 1,2,3,4,5……
So then, what is the Roman numeral for zero?
There is no Roman numeral for zero as zero did not come into play into Western mathematics until about 1200 A.D. The ancients did not really require the use of zero in their arithmetic.
Although zero is nothing, our mathematics is nothing without it.
The divisibility rule for zero is undefined.Try dividing a number on your electronic calculator or in a computer program and it will return an error code.Undefined is a term used when mathematicians have problems explaining a concept.
Below is an interesting video “Zero and One” posted by TheAlexmeister:
For a historical perspective, the “Math Movie Zero” posted by SpookyKat4 provided different insight:
Kids sometimes say, “I call dibs on it” meaning they want to be first in line or are claiming a priority over something or somebody.Also known as “I call front seat!”
In QBasic64 we don’t call this idea dibs we call it DIM.DIM is used to define and claim variables.People don’t like messy surprises and neither do computers.To minimize programming surprises, you need to define variables to give the computer a heads-up of what you will be doing with data.
For example, if you plan on working with data, you need to give names to your variables such as num1, num2 ,x, y, z, Bob or Mr.Jingles. You usually name variables that are easy for you to remember. However, QBasic does have a few rules about how you name a variable, for example, the name can contain only letters and digits.You cannot use a QBasic reserved word.
That’s right, QBasic calls dibs on a lot of words such as PRINT, CLS and DIM so you can’t use those as variables.They are generally commands and functions of the QBasic language.
But wait, there’s more, not only do you get to name variables, you get to define them. There are two basic data types, numbers and characters. If you’re working with whole numbers, maybe define your variable as INTEGER.If you’re working with or characters (text) define your variables as STRING.
DIM Num1 AS INTEGER
DIM Num2 AS INTEGER
DIM Ans AS INTEGER
DIM Corr AS INTEGER
DIM x as STRING
DIM MrJingles as STRING
Make sure your variables blend with your data and program logic otherwise you will learn the complier will let you know in no uncertain terms.
“Will it Blend on a Dibs CommercialWill it Blend on a Dibs Commercial” posted by ntbreaththis.
Children are most familiar with ten as the base of the decimal number system we commonly use in our mathematics.
Scientists, mathematicians, anthropologists, sociologists, historians and philosophers all tend to agree we use base ten as our number system because humans have ten fingers or digits. Really? They are in denial.You want answers?Do you really want me to answer the question why we use base ten?You think you’re entitled to the truth?You can’t handle the truth!
The truth of why we use base ten is stinky feet.Humans have twenty digits, on two hands and two feet.Why not use the digits on our toes for advanced counting?You would double the size of your number system with a base twenty system.
However, people of the ancient past stepped in a lot of doo-doo and other nasty stuff.Even the most primitive people wore shoes of some type so not only did their feet smell but it was a hassle taking on and off your shoes every time you had a number ( >=) greater than or equal to eleven to manipulate in a calculation.This is one reason why humans invented the abacus, so they didn’t have to use their toes for counting.The abacus was the first computer made of wood.
It was the most decent act of human kindness to our noses use ten the base of our number system.The divisibility rules for then are simple.If a number ends in zero, it is divisible by ten.
Classic Movie Line #15” posted by DiNap44. “funny commercial ! (stinky feet)” posted by seknight86.