answersLogoWhite

0


Best Answer

UNCONDITIONAL STATEMENT - EXAMPLE 1

In order to understand what is an 'unconditional' statement; you would first need to understand what is it's opposite, namely, what does a 'conditional' statement mean?

In the world of computer programming, a 'conditional' statement is a logical test...; which tests to see if a certain condition has been met...; before producing any further result.

x = 1

IF x = 1 THEN PRINT "One" ELSE PRINT "NOT one"

The conditional test here is...IF x = 1?...only, then, will the word, "One", get printed out; but, on the other hand, if x does NOT = 1...then, the words, "NOT one", will get printed out, instead. This, I'm sure, you'll agree is really quite logical.

The above example can now be compared with using an unconditional imperative statement...which doesn't use any form of logical check...before producing any further result.

x = 2

PRINT "One"

...Here no logical conditional test has been carried out, first; to check to see if variable x really is equal to 1...and, instead, quite unconditionally, the word, "One", is printed out...as being a strictly imperative command...not being based on any conditional test.

Using an unconditional wholly imperative command is like saying...do this...regardless of what the actual condition(s) is/are...which is, most probably, NOT what the programmer's original intentions were to be able to achieve...?!

UNCONDITIONAL STATEMENT - EXAMPLE 2

Again, I will start off by showing you a 'conditional' test statement; followed by showing you an 'unconditional' statement which doesn't use any test.

In this case the statement we are going to use is the DO/LOOP; which is, usually, used to repeat statements that are being written inside the middle of it.

count% = 0

CLS

DO

count% = count% + 1

PRINT count%

LOOP UNTIL count% = 3

END

In this case the loop uses a variable called, count, which begins with the value 0 outside of the loop...this is called, initialising a variable by giving it a value first before you start using it...which is good programming language technique; inside of the DO/LOOP the value of count is incremented by +1; and, next, this value gets printed out by using the PRINT statement; the last line of the loop is a 'conditional' test statement...LOOP UNTIL count% = 3...which checks to see if the count variable has reached the value 3...if the conditional test is NOT true the loop continues counting upwards...; but, if the conditional test does eventually become true, then, the loop stops counting...whenever the value of count does become equal to 3...and, the program breaks out of the loop...to reach it's final END statement; which is where the program stops running.

We can compare the above loop being based on a 'conditional' test; to one without any conditional test...in other words, an 'unconditional' loop...

count%=0

CLS

DO

count% = count% + 1

PRINT count%

LOOP

END

This last example doesn't include any conditional test statement whatsoever to stop the loop from contining to run...; consequently, we've just gone and built what is known as being called an 'endless loop'...; that is, one which will keep on repeating itself, quite simply, forevermore...; the count variable never stops from being incremented...not until when there is an eventual integer overflow error message...; which means the maximum integer value is 32,767...so, when the count variable reaches that value...and, the program next attempts to increment the count variable by +1 more...the program stops by sending out an integer overflow message...you can check this for yourself by pressing key [F4]...which will still display the output screen...when the program has stopped.

NOTE: Whenever you are going to use, sometimes, tricky loops inside of your program; it's important that you remember to include a test condition which will allow the loop to stop looping; otherwise, you will end up with having gone and created an endless loop! There are times when the use of an endless loop is desireable...as when you wish to make the code run and keep running as in a rolling demo; and, other times, not. The way to break out of an endless loop which just won't stop...is to press both the [CTRL] + [BREAK] keys together, at once. You can try this out yourself...by changing the last program...whereever the variable name, count%, is used...change it to say, instead, count...without any (%) integer symbol sign being tacked onto the end of the variable name...and, then, re-run the program again using keys [SHIFT] + [F5].

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are two unconditional statements in Qbasic?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What are unconditional statements in c plus plus?

Unconditional statements are statements that are invoked unconditionally. Conditional statements have a controlling expression, while unconditional statements do not. For example: void f (bool b) { if (b==true) do_something(); // conditional statement (controlled by the expression b==true) do_something_else(); // unconditional (executes regardless of b's value) }


What are the 2 types of data allowed in QBASIC?

the two types of data used in Qbasic is numeric data and alpha numeric data.


What command statement terminates the qbasic program?

END '...END of program/halt program code execution. *NOTE*: There should be only 'one' END statement written inside of a QBASIC program. I have seen example code where they use multiple END statements; this is wrong!


What is the Meaning of go to statements in c?

A 'goto' statement is an unconditional requirement to go to that part of the program. As such, statements like these cause programs to become unstructured and should be avoided if possible. Goto statements lead to some sloppy and unreadable logic.


What is go-to unconditional in c plus plus?

An unconditional goto is a goto that has no associated conditional expression. The following example demonstrates conditional and unconditional goto statements. int x=rand(); if (x) goto label_1; // conditional goto (when x is non-zero) else goto label_2; // conditional goto (when x is zero) label_1: // ... goto label_3; // unconditional goto (jump past label_2) label_2: // ... label_3: // ...

Related questions

Why are rem statements important in qbasic programming?

qbasic is important because its technology


Differentiate between conditional and unconditional controls in qbasic?

A 'conditional' statement is a logical test while unconditional statement will cause the computer to branch.


What are unconditional statements in c plus plus?

Unconditional statements are statements that are invoked unconditionally. Conditional statements have a controlling expression, while unconditional statements do not. For example: void f (bool b) { if (b==true) do_something(); // conditional statement (controlled by the expression b==true) do_something_else(); // unconditional (executes regardless of b's value) }


Different unconditional statement in C programming language?

The C programming language is generally made up of common conditional statements. Occasionally, unconditional statements such as test that are based on imperative commands.


What are the difference between gwbasic and qbasic?

Difference between QBASIC and GWBASIC?


What are the 2 types of data allowed in QBASIC?

the two types of data used in Qbasic is numeric data and alpha numeric data.


What command statement terminates the qbasic program?

END '...END of program/halt program code execution. *NOTE*: There should be only 'one' END statement written inside of a QBASIC program. I have seen example code where they use multiple END statements; this is wrong!


What is the Meaning of go to statements in c?

A 'goto' statement is an unconditional requirement to go to that part of the program. As such, statements like these cause programs to become unstructured and should be avoided if possible. Goto statements lead to some sloppy and unreadable logic.


What extension would a file saved in Qbasic have?

the extensions of qbasic are that, there are only 80 pixels to write in the qbasic


How do you download QBasic?

In order to Download Qbasic you may do one, both or none of these two things: 1.) Go to "http://www.softpedia.com/get/Programming/Coding-languages-Compilers/Qbasic.shtml" and click download or 2.) use "Google.com" with the keywords Qbasic free download to find another website with a free qbasic downlaod.


What is unconditional truth?

The unconditional truth is the unconditional certainty of paternity and maternity as the two sides of the self-proving same one sexual impregnation sill being sold as unconditional love worldwide. Kmindopath (C) 08202011.


What is go-to unconditional in c plus plus?

An unconditional goto is a goto that has no associated conditional expression. The following example demonstrates conditional and unconditional goto statements. int x=rand(); if (x) goto label_1; // conditional goto (when x is non-zero) else goto label_2; // conditional goto (when x is zero) label_1: // ... goto label_3; // unconditional goto (jump past label_2) label_2: // ... label_3: // ...