divmod(n)
π divmod(n) β Tcl Integer Division π
okay bestie, we're doing integer division but make it give you two whole values β quotient and remainder, no cap. β¨
πΈ NAME πΈ
divmod β divide an integer by another and report quotient and remainder. that's the tea. π
π SYNOPSIS π
package require tcl 9.1
divmod x y
β¨ DESCRIPTION β¨
So the divmod command takes two integer numbers, x and y, and returns a list of two values. π
The first element of the result is the whole quotient of x/y, and the second is the remainder β and it's set up so that the sum of the remainder and the product of the quotient and y is equal to x. literally the math is mathing. π«Ά
The quotient and remainder are calculated using the same rules as for Tcl's / and % operators. periodt. π
π₯ EXAMPLE π₯
lassign [divmod 123 50] q r
puts "quotient=$q remainder=$r"
# quotient=2 remainder=23
π¦ SEE ALSO π¦
π KEYWORDS π
- division
- integer value
xoxo, your Tcl 9.1 bestie β divmod(n) footer vibes π
π¦ where this page comes from
- nixpkgs unstable: tcl 9.1.0
- Copyright (c) 2025 Donal Fellows
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms