15.01.2024 Views

CompTIA A+ Certification All-in-One Exam Guide

  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

languages (but they have many other useful features).

Anatomy of a Script

At their core, programming languages can tell a computer to do something to

some piece of data. You’ve solved math problems, so you are already

halfway to understanding this. In a simple math problem like 3 + 4, you have

two numbers, and a symbol that tells you what operation to perform. In this

case, addition.

EXAM TIP The CompTIA A+ objectives expect you to identify some of

the basic features of a script. Don’t panic! You won’t need to know how to

write or debug a script, but make sure you can spot and name the parts

introduced here.

To do this math problem, you need to know the rules. You learned the

rules of arithmetic back in grade school, right? In arithmetic, each of these

numbers is a value; the rules tell you to add two numbers when you see the +

sign.

But what if the equation looked a little different? What would you do if it

was 3 + cow? That doesn’t make sense! Cow isn’t a number, it’s a word for a

large, grass-eating bovine. You and I know this, but a C and a 3 are both just

characters to the computer. How does it know that it can’t add them?

Data Types

To be able to treat numbers and words differently, computers need a new

concept—data types. A data type is a defined category, like number or word.

In many programming languages, these rules dictate important details, such

as you can’t add the number 3 and the word cow because the two values have

different data types. The number 3 is an integer (i.e., a whole number) data

type, and cow (i.e., a word) is what programmers call a string data type.

Here’s where it gets a little more complicated, but stick with me and it’ll

become more clear!

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!