Giter Club home page Giter Club logo

boolean-basics-exercise's Introduction

programmer joke: !false (it's funny because it's true)

BO0O0OLEANS! Here we go into our journey to make a traffic light...

  • Create a variable named iGetTheJoke and make it equal to a boolean value;
  • Create a variable called havingFun that holds the boolean value that corresponds to whether or not you are. In general, if not in this quiz.
  • Create a variable called learning that holds the boolean value that corresponds to whether or not you are.
  • Create a variable called killingIt and define it in terms of the previous two variables such that it is true if and only if both are.

Now let's make some functions!

  • Create a function named returnFalse that takes one parameter and it always returns false no matter what the parameter is!
INPUT: returnFalse(2)
OUTPUT: false
INPUT: returnFalse(hello)
OUTPUT: false
  • Create a function named theOpposite that takes one parameter that is a boolean and it returns the opposite of it!
INPUT: theOpposite(true)
OUTPUT: false
INPUT: theOpposite(false)
OUTPUT: true
hint **check bang operator**
  • Create a function named both that takes two parameter that are booleans and returns true if they're both true and false otherwise.
INPUT: both(true, false)
OUTPUT: false
INPUT: both(false, true)
OUTPUT: false
INPUT: both(false, false)
OUTPUT: false
INPUT: both(true, true)
OUTPUT: true
hint **check and operator**
  • Create a function named either that takes in two parameters that are booleans and returns true if either is true, and false otherwise.
INPUT: either(true, false)
OUTPUT: true
INPUT: either(false, true)
OUTPUT: true
INPUT: either(false, false)
OUTPUT: false
INPUT: either(true, true)
OUTPUT: true
  • Create a function named neither that takes in two parameters that are booleans and returns false if they're both false, and otherwise returns true.
INPUT: neither(true, false)
OUTPUT: false
INPUT: neither(false, true)
OUTPUT: false
INPUT: neither(false, false)
OUTPUT: true
INPUT: neither(true, true)
OUTPUT: false
  • Create a function named itsComplicated that returns true if the first parameter is false or if both the second and third are true. Otherwise it returns false.
INPUT: itsComplicated(false, false, false)
OUTPUT: true
INPUT: itsComplicated(true, true, true)
OUTPUT: true
INPUT: itsComplicated(true, true, false)
OUTPUT: false

boolean-basics-exercise's People

Contributors

abbreviatedman avatar phenix1229 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.