PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, August 11, 2022

[FIXED] What is the point of writing integer in hexadecimal, octal and binary?

 August 11, 2022     decimal, floating-point, int, swift, var     No comments   

Issue

I am well aware that one is able to assign a value to an array or constant in Swift and have those value represented in different formats.

For Integer: One can declare in the formats of decimal, binary, octal or hexadecimal.

For Float or Double: One can declare in the formats of either decimal or hexadecimal and able to make use of the exponent too.

For instance:

var decInt = 17
var binInt = 0b10001
var octInt = 0o21
var hexInt = 0x11

All of the above variables gives the same result which is 17.

But what's the catch? Why bother using those other than decimal?


Solution

There are some notations that can be way easier to understand for people even if the result in the end is the same. You can for example think in cases like colour notation (hexadecimal) or file permission notation (octal).



Answered By - CarlosMorente
Answer Checked By - Candace Johnson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing