Download presentation
Presentation is loading. Please wait.
Published by화주 자 Modified over 6 years ago
1
Programming In Any Language With “Hello, World!” Examples
Dr. C. Floyd Richmond This presentation could be presented in an hour, or can outline an entire course on any programming language.
2
Elements of All Programs
Variables – Declarations, Numbers, Strings, Boolean, Reserved Words Math – Operations, Comparisons Commands and Functions - Syntax, Data Structures, Input and Output Program Flow - Control Structures, Mains, Subroutines, Conditionals, Objects – buttons, text fields, images, sounds, video, menus, dialogs, alerts, draw Events – keyboard, mouse, touchpad, path hiearchy Input and Output – files, parsing data Tools - Installation, Writing Code, Loading Libraries, Compiling/Running, Debugging Errors
3
Variables and Reserved Words
Variables are symbols (usually a letter, word, or phrase) which are assigned a value by the programmer (examples: A=4, numRight=numRight+1). They are used for saving changeable information for later use (reports, etc.). Reserved words are usually letters, words or phrases defined by the programming language, so they are not available as variables (example (in some languages): pi = ).
4
Variables - Declarations
Some languages require the declaration of the type and value of a variable before it is used. Others create them as needed. Variables may be . . . Global (apply to the entire program – like long-term memory) or Local (apply to only portions of the program – like short term memory).
5
Variables - Types Numbers Strings Booleans
6
Variables - Numbers Categories Integers Real Numbers Precision
7
Variables - Strings Categories Characters Text Length
8
Variables - Booleans Categories
True (1) False (0) In some languages may be used as numbers (as indicated above)
9
Variables - Arrays Some programs support arrays of variables (similar to a column in a spreadsheet), and double arrays (similar to a spreadsheet), and triple and higher arrays (like a three dimensional spreadsheet – a cube).
10
Variables - Arrays The data itself will suggest whether it should be organized into arrays. These operations must be mastered for effective use. Array Creation Array Assignment Array Reference Array Index
11
Math Operations Comparisons
12
Math - Operations Addition (3+4=7)
Parentheses and order of operations (3+4)*5-2=? Subtraction (7-5=2) Power (2^2=4) Multiplication (3*3=9) Roots (8^(1/3)=2) Division (9/3=3) Modular math (5mod2=1) Equal (assignment) Rounding Random
13
Math - Comparisons Equal AND Not Equal OR Greater than NOT Less Than
Is subset Is true Is false
14
Commands and Functions
Execute instructions with given parameters May return success or failure of operation Functions Execute calculations with given parameters Returns the value of the calculation
15
Commands and Functions
Built-in User-Defined
16
Program Flow Program Flow Control Structures – Main and Subroutines
Conditionals (If then else, while, onErr)
17
Objects Links Internal External Creating, reading and setting values
18
Objects Buttons Creating, reading and setting values Radio Buttons
Checkboxes Popup Options Creating, reading and setting values
19
Objects Text Boxes Creating, reading and setting values Single line
Multiple line Creating, reading and setting values
20
Objects Menus Submenus Creating, reading and setting values
21
Objects Dialogs Alerts Creating, reading and setting values
22
Objects Types: Images, Videos, Sounds
Operations: Preloading, Loading, Checking, Playing, Pausing, Stopping, Locating points, Moving to points, Replacing, Sequencing, Linking Creating, reading and setting values
23
Objects Drawing shapes Creating, reading and setting values
24
Events - Input and Output
Keyboard Mouse Touchscreen
25
Files - Input and Output
Parsing Data Text: characters, words, items, paragraphs Numbers (rounding and precision)
26
Files - Input and Output
Saving Data Save file locally Save file on a server Upload to a service Save cookies
27
Tools Installation Writing Code Libraries Compiling/Running
Debugging/Errors
28
Hello World Javascript PHP Visual Basic Python Java
29
Hello World - JavaScript
<html><body> <script> alert( 'Hello, World!' ); </script> </body> </html> Copy and paste this text into a text editor and save it as helloworld.html. Open the saved file with a browser.
30
Hello World - PHP <html><body> <?php echo '<p>Hello, World!</p>'; ?> </body></html> Copy and paste this text into a text editor and save it as helloworld.html. Open the saved file with a browser.
31
Hello World – VisualBasic
Module Hello Sub Main() MsgBox("Hello, World!") End Sub End Module Run VisualBasic in Windows. File>New Project. Copy and paste this code into the program area. Press play to run.
32
Hello World – Python print("Hello, World!")
Run the terminal, type python, and at the prompt, type the command above and press return. Quit Python by typing quit and pressing return . . . OR . . . Copy and paste this text into a text editor and save it as helloworld.py. From the terminal, type python, then run ”helloworld.py” Quit Python by typing quit and pressing return.
33
Hello World – Java public class HelloWorld { }
public static void main(String[] args) {System.out.println("Hello, World!"); } } Copy and paste this program into a text file, save it as helloworld.java. From the terminal, compile it by typing javac “helloworld.java” Execute it from the terminal by typing java helloworld.
34
Hello World – Swift (Apple iOS and OSX)
labelText.text=“Hello, World!” Run Xcode and create single view application, click next, and save. Go to main.storyboard, create a label with no display name, Go to ViewController.swift, After “class ViewController: UIViewController {” and before “}” . . . Control-drag from the label in the main.storyboard to the code area and name it labelText. Press return and enter the code above (labelText.text=“Hello, World!!”) Run as an iPhone or iPad app. For a similar but more sophisticated project see this link: Hello: Calculator: Creating applications for OSX is exactly the same, but build for OSX instead.
35
Real World Examples By Floyd Richmond
36
Music Fundamentals Lessons
37
Saxophone Fingerings
38
Online Notation Proof of concept
39
Programming In Any Language With “Hello, World!” Examples
Dr. C. Floyd Richmond
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.