[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/httpsa/javascript/master/conditional/README.md [Back]  [Original]

# Conditional Logic

A condition is a test for something. Conditions are very important for programming, in several ways:

First of all conditions can be used to ensure that your program works, regardless of what data you throw at it for processing. If you blindly trust data, youll get into trouble and your programs will fail. If you test that the thing you want to do is possible and has all the required information in the right format, that wont happen, and your program will be a lot more stable. Taking such precautions is also known as programming defensively.

The other thing conditions can do for you is allow for branching. You might have encountered branching diagrams before, for example when filling out a form. Basically, this refers to executing different branches (parts) of code, depending on if the condition is met or not.

In this chapter, we'll learn the base of conditional logic in Javascript.

Web Proxy Viewer  |  New URL  |  Original Page