Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Computer Programming

Similar presentations


Presentation on theme: "Introduction to Computer Programming"— Presentation transcript:

1 Introduction to Computer Programming
Just Basic

2 What is a Program? page 0 A program is a set of instructions that tells the computer what to do. Syntax is what is used to communicate with the computer, it is the grammar rules of the computer language. When creating a program the creator must use the correct Syntax.

3 What is the Purpose of Programming?
The purpose of programming is to: use computers to solve problems caused by computers Teach a computer to do something Computer program includes step by step descriptions of generative, decision-making, and response processes: what it does and how it interacts with you.

4 Syntax A Program must use syntax in order to execute. Syntax is made up of symbols, commands, statements or keywords recognized by a Program. A BASIC program must include the following rules: “quotation marks” around data to appear on the screen. ;semicolon to show separation (between sentences, and questions from answers). A Label is used to organize code and is any word that is contained in brackets. It is a place to branch or goto during program execution (these cannot be seen in the execution of the program)

5 Color Coded Syntax Syntax within a JustBasic program is color in coded: Labels are black Statement/commands are blue Variables are blue green Functions are burgundy Values are red Output is green

6 Statements and Commands
A line which has an instruction for the computer is considered a statement/command. There are several commands or statements used for programming in BASIC. These commands, statements or special keywords tell the computer to do something. For example, one of the simplest commands in BASIC is the PRINT statement. There are also statements of condition known as: Conditional statements

7 Variables BASIC uses functions to operate a program.
Some functions used in BASIC are considered Variables. There are two types of variables Numeric Variables String Variables

8 Functions This statement defines a function.
The function can return a string value, or a numeric value. A function that returns a string value must have a name that ends with the "$" character. A function that returns a numeric value must not include a "$" in its name. Zero or more parameters may be passed into the function. A function cannot contain another function definition, nor a subroutine definition. Note that the opening parenthesis is actually part of the function name. Do not include a space between the name and the opening parenthesis, or the code generates an error.

9 Numeric Variables Are created when a value is assigned
Can be any number Used to perform operations (adding, subtracting, square root, etc.) And are used to perform numeric operations Can be predefined or user defined: Examples of predefined: A=6, health=25 Numeric variables hold either a double-precision floating point value, or an integer

10 String Variables Any character or group of characters. This function is followed or differentiated by a $ and can be predefined or user defined. Cannot perform calculations When assigning a value to a string, the value must be enclosed in Quotation marks Examples of predefined: A$=“no”, Name$=“John Doe”.

11 Values


Download ppt "Introduction to Computer Programming"

Similar presentations


Ads by Google