Dictionary entry
div
Last updated
Meanings
nouncountablecomputing
A programming operation that divides one whole number by another and gives only the whole-number result, throwing away the remainder.
Grammar: Often used with the name of a language: Python's div, the div function.
Patterns
- the div operator
- use div to do something
- div something by something
In many languages, 7 div 2 gives 3, because the remainder is dropped.
Use div when you want a whole number and do not care about the fraction.
The teacher explained that div is different from normal division, which would give 3.5 here.
nouncountablecomputing
A section or container in a web page, especially the HTML element named div.
Grammar: Common in web design talk; you can say 'a div' or 'the div element'.
Patterns
- a div element
- wrap something in a div
- style a div
She put the whole menu inside a single div.
If the layout looks wrong, check the div that holds the sidebar.
Each div can be given its own background color.
Word forms
| plural | divs |
|---|
Common combinations
- integer division
- Integer division, often written as div, ignores any remainder.
- div operator
- The div operator is useful when you are counting whole items.
- div element
- The div element is a generic block on a web page.
- div by zero
- The program crashed because of a div by zero error.
Synonyms and how they differ
- quotient
- Quotient is the mathematical result of division and can be a decimal, while div usually means only the whole-number part.
Word family
Commonly confused: div or mod? div or division?
div vs mod
Mod gives the remainder after division, while div gives the whole-number result. For 7 divided by 2, div gives 3 and mod gives 1.
div vs division
Division is the everyday word for the operation; div is a short, technical name for one kind of it in programming.
Practice
In a programming language, what does the expression 9 div 4 give?
Choose one answer.
Div returns only the whole-number part, so 9 divided by 4 gives 2. The answer 2.25 is normal division, and 1 is the remainder (the mod result).
Make it your own
Write a sentence using “div”, then check it and compare it with the examples above.