🖥️
Intro to Computer Science (ICS3U/C)
  • An Introduction to Computer Science
  • Videos & Slides
  • Unit 1: In the Beginning
    • The History of Computers
    • Binary & Logic
      • Bits and Bytes (Binary)
      • Transistors (Changing Bits)
      • Logic Gates
        • Poster
        • Logic.ly
    • The Parts of a Computer
  • Unit 2: Intro to Code
    • How Do We Code?
      • Coding Conventions (Rules)
      • Commenting Code
    • What is HTML?
      • Hello World! (in HTML)
      • HTML Slideshow
    • Hello World!
    • Input / Output
      • The Console
      • Prompt, Alert, Confirm
    • Variables & Data
      • Strings (Text)
      • Numbers (Values)
        • Converting & Rounding
        • The Math Object
          • Random Numbers
      • Booleans
        • Truthiness
      • Arrays
  • Unit 3: Control Flow
    • Conditionals (if this, do that)
      • If...Else
        • Logical Operators
      • Switch / Case
      • Ternary Operators
    • Loops (Repeating Code)
      • For...Loop
      • While & Do/While Loops
    • Debugging
  • Unit 4: Functions
    • Functional Programming
    • User Defined Functions
      • Hoisting and Scope
    • Calling a JS Function
  • TL;DR
    • Programming Basics
    • Slideshows & Demos
    • Javascript Syntax Poster
  • Advanced Topics
    • Recursion
    • Structures & Algorithms
    • Mmm... Pi
  • External Links
    • Typing Club!
    • repl.it
    • Khan Academy
    • Geek Reading
    • ECOO CS Contest
Powered by GitBook
On this page
  • Text-Driven Input
  • Event-Driven Input
  1. Unit 2: Intro to Code

Input / Output

Input from the user and output to the user are the basics of most computer programs. We call this Basic IO.

PreviousHello World!NextThe Console

Last updated 6 years ago

Text-Driven Input

Your program will take input from the user in the form of typed answers, or text. This is the simplest method of gathering input from the user. Some languages allow input on the command-line or wait for the user to type a response, some do both. This is text-based input where the user utilizes the keyboard to enter data.

Javascript utilizes the command for this (not available in Node.js).

Event-Driven Input

User input can also be collected with the click of a mouse, a voice command, or a selection from options. We call these actions Events. Essentially, your program "listens" for events and when one happens, it reacts accordingly.

Later in the course, if we progress well enough, we can learn how to deal with a user clicking a button or selecting something on a webpage. This would take us away from the console and allow us to develop a front-end or graphical user interface (GUI). Hopefully more on that later.

prompt()