Games
Problems
Go Pro!

Ask Professor Puzzler


Do you have a question you would like to ask Professor Puzzler? Click here to ask your question!

Brock from Canada asks, "Computer programmers use hexadecimal code. I have read and learned your lesson on that but I cant figure out where to put and what the symbols mean when coding. these symbols are #,*,&. what do these symbols mean and where do I insert them when I am doing my programming?"

Hi Brock, thanks for your question. The answer is: it depends on the programming/scripting language you are using. Here are just a few examples. Note that in each example, the symbol (or symbols) that indicate a number is a hexadecimal value is shown in bold text.

If you were programming in the language C or C++, and you wanted to include a hexadecimal number in your program, it might look something like this:

int x = 0xFC;

If you were programming in Javascript your code would look the same.

If you were developing a website using HTML/CSS, and you wanted to provide a color as a hexadecimal value, it would look like this:

background-color:#FF0000;

This is equivalent to:

background-color:rgb(255,0,0);

If you were programming in PHP, you would also use 0x:

$x = 0xA3;

If you were programming in Visual Basic, you could write a hexadecimal number like this:

Dim x as Integer = &h2D

In Pascal (which I learned in college back in the 80s, but haven't used since), a hexadecimal value would be written with a dollar sign:

x := $B8;

Blogs on This Site

Reviews and book lists - books we love!
The site administrator fields questions from visitors.
Like us on Facebook to get updates about new resources
Home
Pro Membership
About
Privacy