Binding, Functions and Control Flow - Reading Assignment

1. A fragment of code that produces a value.

2. Binding or variable is used to catch and hold values.

3. A collection of bindings and their values that exist at a given time.

4. A function is a module of code that accomplishes a specific task. A function usually takes certain data as input, processes the data, and returns the result.

5. This function takes the name of a coin as input and checks if @ivan is currently shilling it :wink:

function isShilling(coin) {
    if (coin == "EOS") {
      return true;
    } else {
      return false;
    }
  }

6. Showing a dialog box, writing text to the screen or a change to the internal state of the machine in a way that will affect the statements that come after it.

7.

  function add(x, y) {
     return x + y;
   }

  function addWithSideEffect(x, y) {
     alert("This is a side effect");
     return x + y;
   }

8. Order in which statements are executed.

9. Decision point of the program based on certain conditions.

10. if

5 Likes
  1. Fragment of code that produces value.
  2. Binding or Variable allows us to create a name value pair. Name is must but value is not necessary.
  3. The collection of bindings and their values that exist at a given time.
  4. Function consists of a statement or number of statements to perform certain task. It can accept various number of arguments.
  5. Prompt, log etc.
  6. Side effects: When a statement changes the behavior, state of the program which is observable.
  7. Prompt or log are examples of functions which result in side effect but Math.Max and Math.min produce value.
  8. Control flow of a program is the order or the path taken to execute the statements in that program.
  9. Conditional execution dictates which one of the available path to follow based upon certain criteria.
  10. IF, Else

What is an expression?

Quoting directly, “A fragment of code that produces a value is called an expression”

What is a binding?

Binding is the relationship between a name and a value in javascript

What is an environment?

Environment is the collection of bindings and values in the current session or page

What is a function?

a Function is a piece of program wrapped in a value (quoting direclty)

Give an example of a function.

console.log() or prompt()

What is a side effect?

It is when a program or function modifies something outside its scope or design, such as outputting the the console in addition to executing its definition.

Give an example of a function that produces a side effect and another function that produces a value.

prompt(“hello”) has the side effect of outputting on the console

What is control flow?

Control flow is the order of statements executed in a program, it can be modified from sequential using logical branching and / or looping structures.

What is conditional execution?

It is a logical test that determines which path to follow if the test is true, or an alternative path if it is false.

What kind of keyword do you need to use to invoke conditional execution?

IF and ELSE keywords and its variations.

1 Like
  1. A fragment of code that produces a value is called an expression.
  2. Used to catch and hold values
  3. The collection of bindings and their values that exist at a given time is called
    the environment.
  4. A function is a piece of program wrapped in a value.
  5. prompt(“Enter passcode”);
  6. A change that affects the internal state of the machine in a way that will affect the statements that come after it.
  7. a, console.log(“hello”); b, Math.max(2, 4);
  8. The order in which individual statements, instructions or function calls of an imperative program are executed or evaluated.
  9. When a block of code is executed only if a condition is met.
  10. if and else
  1. What is an expression?
    A fragment of code that produces a value. Every value
    that is written literally (such as 22 or “psychoanalysis”) is an expression. An expression between parentheses is also an expression, as is a binary operator applied to two expressions or a unary operator applied to one. Expressions can contain other expressions in a way similar to how subsentences in human languages are nested—a subsentence can contain its own subsentences, and so on. This allows us to build expressions that describe arbitrarily complex computations.

  2. What is a binding?
    A binding or variable catches and holds values. Ex. let caught = 5 * 5;
    The binding caught holds the value 25.
    When a binding points at a value, that does not mean it is tied to that
    23 value forever. The = operator can be used at any time on existing bindings to disconnect them from their current value and have them point to a new one.
    let mood = “light”;
    mood = “dark”;

  3. What is an environment?
    The collection of bindings and their values that exist at a given time. When a program starts up, this environment is not empty. It always contains bindings that are part of the language standard, and most of the time, it also has bindings that provide ways to interact with the surrounding system. For example, in a browser, there are functions to interact with the currently loaded website and to read mouse and keyboard input.

  4. What is a function?
    A piece of program wrapped in a value. Such values can be applied
    in order to run the wrapped program. For example, in a browser environment, the binding prompt holds a function that shows a little dialog box asking for user input. It is used like this: prompt(“Enter passcode”);

  5. Give an example of a function.
    function sum (num1, num2){
    return num1 + num2;
    }

  6. What is a side effect?
    Showing a dialog box or writing text to the screen is a side effect. A lot of functions are useful because of the side effects they produce.

  7. Give an example of a function that produces a side effect:
    prompt(“Enter passcode”);

Example of another function that produces a value:
Math.max(2,4);
Produces the value 4.

  1. What is control flow?
    Statements are executed from top to bottom sequentially, straight-line control flow.

  2. What is conditional execution?
    A program with branches and the program takes the proper branch based on the situation.

  3. What kind of keyword do you need to use to invoke conditional execution?
    If keyword and use the else keyword for alternative paths.
    If(condition 1){
    statement block 1
    }
    else if(condition 2){
    statement block 2
    }
    else{
    statement block 3
    }

What is an expression?
A fragment of code that produces a value is called expression

What is a binding?
To catch and hold values, the value of such an expression is the value the binding already holds

What is an environment?
The collection of binding and their values that exist at a given time is called the environment

What is a function?
Piece of program wrapped in a value

Give an example of a function.
The prompt function uses the string that we give it as the text to show in the dialog box

What is a side effect?
Application state change that is observable outside the called function other than its return value

Give an example of a function that produces a side effect and another function that produces a value.
Console.log produces a side effect
Let z = 1; is not a side effect

What is control flow?
Is the order in which computer executes statements in a script

What is conditional execution?
Not all programs are straight roads for example want to create a branching road, where the program takes proper branch based on the situation at hand

What kind of keyword do you need to use to invoke conditional execution?
If, else, while, loop

1 Like
  1. What is an expression?
    It’s a succession of letters, numbers or other charecters.
  2. What is a binding?
    A binding or variable memorises a value. Maybe it can be said,
    that it points to an address, where a value is stored.
  3. What is an environment?
    The envirement is like a space, which gives us the possibility to interact with existing
    functions and bindings. Furthermore it can give the ability to create or delete
    functions and bindings.
  4. What is a function?
    A function is a piece of code, which can be seperated from the rest to be used more than one time for getting an output created by a logical usage of input arguments.
  5. Give an example of a function.
    Math.sqrt(4); //-> 2
  6. What is a side effect?
    A side effect is a result, which is a consequence of a logic, but not its main purpose.
  7. Give an example of a function that produces a side effect and another function that produces a value.
    add(a,b) {return a + b;}
    This function is meant to make a summation, but if you put in Strings,
    we get a concatenation as a side effect. It produces a value, too.
  8. What is control flow?
    It is the execution of the code, which is from top to bottom.
    To change something, we can reorder commands.
  9. What is conditional execution?
    To gain more control of the flow of the code, an if/else structure can be used,
    so that depending on different inputs different results can be produced.
  10. What kind of keyword do you need to use to invoke conditional execution?
    if () {…} else if () {…} else {…}
    while () {…}
1 Like
  1. An expression is a fragment of code that produces a value.

  2. To catch and hold values, JavaScript provides a thing called a binding, or variable. For example the keyword let indicates that this sentence is going to define a binding. After a binding has been defined, its name can be used as an expression.

  3. The collection of bindings and their values that exist at a given time is called the environment.

  4. A function is a piece of program wrapped in a value. Such values can be applied in order to run the wrapped program. You can call a function by putting parentheses after an expression that produces a function value.

  5. prompt(“Enter your Name”)

  6. A side effect is when a statement affect the world. It could for example display something on the screen or change the internal state of the machine in a way that will affect the statements that come after it.

  7. For side effect: alert(“Hello world!”);
    For returning value: console.log(Math.max(2, 4));

  8. When your program contains more than one statement, the statements are executed as if they are a story, from top to bottom. This is a straight-line control flow.

  9. A conditional execution is when we create a branching road and the program will take the proper branch basing on the situation or condition that we give to it. So the code (or a part of the code) will only execute if a certain condition is fulfilled.

  10. One can use for example if and else.

What is an expression?
a value from a fragment of code that corresponds with other expressions and values.
What is a binding?
It’s a way to save or a assign traits to values to be interpreted as such until altered.
What is an environment?
A collection of bindings and their values that exist at any given time.
What is a function?
Its a piece of the program wrapped in a value that can be applied by the program.
Give an example of a function.
console.log would be a function.
What is a side effect?
Showing a dialog box or writing text to a screen.
Give an example of a function that produces a side effect and another function that produces a value.
console.log(Math.max(3,7));
// -> 7.
What is control flow?
The order in which your statements are executed.
What is conditional execution?
a branch based on a situation in the program that lets you alter the path of the execution based on your input.
What kind of keyword do you need to use to invoke conditional execution?
If, else, while or loop.

What is an expression?
An expression is a piece of code that produces a value.

What is a binding?
Binding (or variable) is a way for a program be kept internally within a computer. Binding is method to reference a value when called upon.

What is an environment?
An environment is a collection of bindings(or variables) to exist within a period of time.

What is a function?
A function is code that enables to be retrieved when asked to perform a particular task.

Give an example of a function.

function myFunction(p1, p2) {
return p1 * p2;
}
What is a side effect?
A side effect is the display of a dialog box or written text to the screen.

Give an example of a function that produces a side effect and another function that produces a value.
prompt(“This will produce a side effect.”)

What is control flow?
Control flow is the matter in which code is to be run. When the code consists of more than one statement, the code is executed from top to bottom.

What is conditional execution?
A conditional execution is the operation of code where certain condition in order for a particular is to be conducted. This is usually conducted by logical operators to determine the outcome of the code.

What kind of keyword do you need to use to invoke conditional execution?
To trigger invoke conditional execution, the programmer will have to state an “if/else” statement.

  1. What is an expression? An expression is a combination of symbols – identifiers, values, and operators – that yields a result upon evaluation. The resulting value can then be assigned to a variable, passed as an argument, tested in a control statement, or used in another expression.
  2. What is a binding? To bind is to associate two pieces of information with one another. It is most often used with reference to associating a symbol (such as the name of a variable) with some descriptive information (such as a memory address, a data type, or an actual value).
  3. What is an environment? The collection of bindings and their values that exist at a given time is called the environment. This means that it contains bindings that are part of the language standard, and most of the time, it also has bindings that provide ways to interact with the surrounding system.
  4. What is a function? A function is a piece of a program wrapped in a value.
  5. Give an example of a function. console.log(“Hello universe!”);
  6. What is a side effect? A side effect is where a function does something other that return a value such as writing to the screen or displaying a prompt or a dialog box.
  7. Give an example of a function that produces a side effect and another function that produces a value. prompt(“press any key.”); console.log(5 + 5);
  8. What is control flow? Control flow is the sequence program statements are executed in, including when they are not executed sequentially or are executed conditionally. It is the direction of flow or the path that control is executed in in the flow of the program. It is the tracing of all possible execution paths in a program, often represented in the form of a diagram.
  9. What is conditional execution? Execution based on whether or not a certain condition holds (or hodls). :wink: This is where a program can branch based on the situation at hand.
  10. What kind of keyword do you need to use to invoke conditional execution? Conditional execution is created with the “if” keyword in JavaScript.
1 Like
  1. An expression is a fragment of code that produces a value
  2. A binding is a variable
  3. The collecion of variables and values sored in memmory at any given time is called an enviroment
  4. A function is a piece of programm
  5. alert(“text to be showen”);
  6. A programm may affect chanhes outside of it’s scope variable, on the outher world like screen or states. Theese changes are called side effects.
  7. Side effect: console.log(firstAccount);
    Value: var d = new Date();
  8. Is the logical flow of instructions within a programm
  9. Branching the controll flow of a programm based on a specific condition represents a conditional execution
  10. If - else and switch statements.
  1. What is an expression?
    A fragment of code that produces a value.

  2. What is a binding?
    A binding is when a variable has a value assigned to it.
    A value is stored in memory, and a variable is pointed to the location in memory where that value is stored.

  3. What is an environment?
    The collection of bindings and their values that exist at any given time.

  4. What is a function?
    A function is a piece of program wrapped on a value.
    It is a way of being able to reuse code without having to repeat the same statements over and over again.

  5. Give an example of a function.
    prompt("Enter a value: ");

  6. What is a side effect?
    A side effect is a change made by a function that isn’t returned by the function.
    It could be printing something to the console, or changing the internal state of the machine in some way that affects statements proceeding it.

  7. Give an example of a function that produces a side effect and another function that produces a value.
    Example of a function that produces a side effect:

function printToScreen(words) {
    console.log(words);
}

Example of a function that produces a value:

function returnValue() {
    return "Hello World!";
}
  1. What is control flow?
    A program executes one statement after another. Sometimes the code will branch one way or another way given certain conditions, executing some statements and not others depending on what conditions have been met. The direction a program takes as it is executed is known as control flow.

  2. What is conditional execution?
    Portions of code will run only if certain conditions are satisfied.

  3. What kind of keyword do you need to use to invoke conditional execution?
    Often if statements are used to execute code provided certain conditions are met.

1 Like
  1. A fragment of code that produces a value is called an expression.
  2. To catch and hold the new produced value
  3. Collection of bindings and their values that exist at a given time
  4. A piece of program wrapped in a value
  5. Prompt for login
  6. Showing a dialog box or writing text to the screen
  7. Console.log(Math.max(2, 4)) and Console.log(Math.max(2,4)+100)
  8. Like a story from top to bottom
  9. For If situation
  10. If

1 - Code that produces a value

2 - A binding is that which points to a value, Also called Variable

3 - A collection of bindings or variables.

4 - A function is a program within a binding.

5 - Function testScores (Student, Scores) {
Console.log(Student: + " " + Scores)
};

testScores (Ivan, 10);

6 - Side effect is when a given function or statement modifies values outside of its scope.

7 - Value example: console.log(1+1);
Side effect example: prompt(“Name”);

8 - The order in which the code is executed.

9 - when the order of the executon is branched in multiple paths.

10 - Can be done with the (if, else if, else) statements.

1- A fragment of code that produces a value is called an expression.
2-To catch and hold values,Javascript provides a thing called binding or variable. Usually, we use the word “let” for binding.
3- The collection of bindings and their values that exist at a given time is called the invironment .
4- A function is a piece of program wrapped in a value.
5- console.log() that writes out its arguments to some text output device.
6- showing a dialog box or writing text to the screen is a side effect.
7- prompt() produces side effect and Math.max() returns a value.
8- When the program contains more than one statement, the statements are executed as if they are
story, from top to bottom which is called control flow.
9- Not all programs are straight roads. we may want to create a branch road , where the program takes proper branch based on the situation in hand.
10- If , else keywords.

1. What is an expression?
Any code that produces a value is called an expression.

2. What is a binding?
Binding is the act of linking a value to a variable.

3. What is an environment?
This describes the list of variable and values within the program.

4. What is a function?
A function is an expression or groups of them stored in a variable.

5. Give an example of a function.
Alert(“Hello world!”);

6. What is a side effect?
This is having values displayed on-screen.

7. Give an example of a function that produces a side effect and another function that produces a value.
8>4; produces a side effect.
Var sum = 9+1; produces a value.

8. What is control flow?
Control flow describes the need of values at the top for code at the bottom to be executed.

9. What is conditional execution?
Conditional execution is to select the sequence of code execution based on values.

10. What kind of keyword do you need to use to invoke conditional execution?
We use the keywords “IF and “ELSE”.

Blockquote

1:a fragment of code that produces a value
2:a way for your program to attach a value to an variable (let, var, const)
3:a collection of bindings and their values that exist at any given time
4:a piece of program wrapped in a value
5:prompt(“enter text”)
6:something a function may produce like a dialogue box
7:alert(""); will give dialogue box…Math.max will give the max value of inputted values
8:the order that statements or functions are executed or evaluated
9:a conditional path for a program depending on the situation
10:if and else

Blockquote

What is an expression?
A fragment of code that produces value.
What is a binding?
It catches and holds values.
What is an environment?
The collection of bindings and their values that exist at a given time.
What is a function?
A function is a piece of program wrapped in a value.
Give an example of a function.
prompt(“Enter passcode”);
What is a side effect?
A change in the internal state of the machine in a way that will affect the statements that affects the statements that come after it.
Give an example of a function that produces a side effect and another function that produces a value.
For side effect: alert(“Coding is fun”);
For returning value: console.log(Math.max(200, 100));
What is control flow?
The code is executed from top to bottom.
What is conditional execution?
when the program has a choice between branching paths which are taken based on certain conditions.
What kind of keyword do you need to use to invoke conditional execution?
If

  1. an expression is a piece of code that comes up whit a value, pieces of code that have a input and a outcome if i’m thinking correctly.
  2. a binding is an interchangeable conection, a piece of memory that you can repeat.
  3. an environment is the collection of bindings and their values that exist at a given time, so my ques is that its the total som of possibilities & probability in a program.
  4. A function is a piece of program wrapped in a value.
  5. prompt (“Enter what ever you whant”)
  6. Side effect is changing something somewhere.
  7. prompt (“Enter what ever you whant”) produces a side effect, console.log(Math.max(1365, 3489)); produces a value.
  8. control flow is the way the program has to read, the story a program has to tell, the road youre code will have to take.
  9. a condisional execution is when a program makes a disition on the road to take based on the situation at hand.
  10. if & else