Yes or No?

In the continuing saga of data types (we have covered text/string and numbers/integers), we continue with boolean. A funny sounding word, but a fundamental data type. With data types, we try to emulate ‘real world’ objects within our code. So words are strings and numbers are…well…numbers. Boolean is yes/no, true/false, on/off.

Think of it like a light switch (without a dimmer…that is just a wishy-washy light switch). You flip the switch one direction and it is on, and the other is off. Boolean values are used in various ways in programming. We can use it to set preferences on a program, check if the end user did something or not…basically aid in making decisions within our programs.

Here is a JavaScript example of setting a variable to a boolean type…

[code lang=”js”]
var x = true;
var y = false;
[/code]

Again, as I have stated before, JavaScript plays ‘fast and loose’ with typing. So if you are using a strictly typed language, you need to make the appropriate code adjustments. Additionally, in JavaScript, you have to watch that you are not changing your data types.

Happy Coding!

More To Explore

Code

Exploring the Broadcast Channel API: Inter-Tab Communication

Intercommunication between different contexts (like tabs, iframes or workers) of the same origin has often been a challenge. With the Broadcast Channel API, developers now have a powerful tool to easily communicate between browsing contexts. In this blog post, we’ll dive deep into the capabilities of the Broadcast Channel API, exploring its features, use cases, and how it can be effectively implemented in your projects.

computer, laptop, work place-2982270.jpg
Code

Unlocking Wireless Communication: A Dive into the Bluetooth API

Wireless communication has become an integral part of our daily lives, and Bluetooth technology is at the forefront of this revolution, enabling devices to exchange data over short distances and creating a world more interconnected than ever before. At the heart of this technology lies the Bluetooth Application Programming Interface (API), a powerful tool for developers looking to harness the capabilities of Bluetooth in their applications. In this blog post, we’ll explore what the Bluetooth API is, how it works, and the possibilities it opens up for innovation in wireless communication.

Share This Post

small_c_popup.png

Need help?

Let's have a chat...


Login

Jump Back In!

Here at Webolution Designs, we love to learn. This includes sharing things we have learned with you. 

Register

Begin Your Learning Journey Today!

Come back inside to continue your learning journey.