Return to main page
View source or report issues on GitHub

Programming Languages, Variables, and Functions

These notes are intended to be used AFTER the “myFirstFunction Typescript” assignment.

Programming Languages

A programming language:star:, like any language, consists of a vocabulary, syntax, and a set of grammar rules for instructing a computer to perform tasks. Unlike a human language, in a programming language these all need to be unambiguous, consistent, and predictable; computers don’t understand emotion or sarcasm!4.3.3

Computers don’t speak the programming languages directly; computer processors only understand a very small number of very specific instructions and all programming languages must be translated to that machine language:star:4.3.5.

Programming languagues come in LOTS of different shapes and sizes, with different purposes and capabilities.

Some key languages for this class

javascript logo

TypeScript logo

java logo

Language Features

Check your Learning

Try to answer these in your head WITHOUT looking back, then check your answers. This is called recall practice and has been shown in many, many studies to be a far more efficient way of learning than if you skip the attempt to recall. Answers for each one can be found by hovering over the blank area below them.

  1. What are the features of a programming language?

    Click to expand answer

    A fixed vocabulary, syntax, and set of grammar rules.

  2. What does it mean to compile a program?

    Click to expand answer

    To convert the code into another language, such as machine language or javascript

  3. What does it mean that TypeScript and java have static variable types?

    Click to expand answer

    Each variable can only hold one type of data, decided when the variable is made.

  4. What is the output value of a function called in programmer speak?

    Click to expand answer

    the return value

  5. Can you write a function in TypeScript or java that accepts two numbers (integers) as input variable, and returns the difference between them?

    Click to expand answer
    1
    2
    3
    
    function diff(a:number, b:number) {
        return a-b;
    }
    

Preparing Study Materials

Bitmoji Books Create flash cards or a deck with the following prompts on the front, then write brief bullets or summaries to put on the back that include what they are for and (if applicable) what they might look like in TypeScript and java:

We have a quizlet class at https://quizlet.com/join/S8XGx3k93 and you can add your decks there if you make them, but you REALLY should make your own deck before using those of others. You learn as much from making the flashcards as using them, if not more.