====== INT ======
Returns the integer value immediately lesser than or equal to the given number, also with a negative argument.
/*
For the lines below, just create links, separated by commas, to other pages of the BASICs section,
like [[:basics:basicTagName]].
"Implemented by" should mention BASICs which implement the keyword like described, in a more usual and standard way.
"With variations" should point to BASICs where this keyword is used a bit differently.
"Also written as" should list alternative spellings and abbreviations this keyword has. No need to
refer to a BASIC, there is a section for that later.
*/
**Implemented by:** [[:basics:Dartmouth:dartmouth3]], [[:basics:ANSI:ansimin]], [[:basics:hptsb:]], [[:basics:decbasic:]], [[:basics:Altair:]], [[:basics:TI994:]], [[:basics:CBM:]], [[:basics:Atari:]], [[:basics:msatari:]], [[:basics:trs80:]], [[:basics:trs80:level2]], [[:basics:trscolor:]], [[:basics:trscolor:colormc]], [[:basics:Sinclair:zx81]], [[:basics:BBC:]], [[:basics:GWBASIC:]], [[:basics:MSX:]], [[:basics:bwbasic:]], [[:basics:bwbasic:bw32]], [[:basics:ABasiC:]], [[:basics:msqb:QBasic]], [[:basics:VBDOS:]], [[:basics:FreeBASIC:]], [[:basics:Gambas:]], [[:basics:minibasicmm:]], [[:basics:minibasicjs:]], [[:basics:EndBASIC:]]
**With variations:** [[:basics:Dartmouth:dartmouth1]] ('always operates by chopping off the fractional part'), [[:basics:Applesoft:]] (also used as a command to invoke [[..:a2int|INTEGER BASIC]]), [[:basics:Sinclair:spectrum]]
**Also written as: **
===== Usage =====
/* For inline examples of syntax, write the keyword between '' and '' (two single quotes) */
INT has been for long the math floor function of BASIC, to round fractional numbers down to the nearest lesser integer. This is not the same thing of a simple cut off of whatever comes after a decimal point, like [[FIX]] does. The difference is visible when the number to be converted is negative:
10 A = -12.35
20 PRINT INT(A) ' shows "-13"
30 PRINT FIX(A) ' shows "-12"
==== Variations ====
In [[:basics:applesoft|Applesoft FP BASIC]] in the Apple II Plus and later computers, INT can also be used as a command, without arguments, for clearing the memory and starting [[:basics:a2int|INTEGER BASIC]].
===== Examples =====
/*
Below is an example of a code block, using GeSHi syntax highlighting for //gwbasic//. Other styles of interest might be
//basic4gl//, //blitzbasic//, //freebasic//, //gambas//, //locobasic//, //purebasic//, //qbasic//, //sdlbasic//,
//thinbasic//, //vb//, //vbnet//, //xbasic// or //zxbasic//.
10 PRINT "HELLO"
*/
===== Comments =====
INT is one of the functions implemented since [[:basics:dartmouth:|Dartmouth BASIC First Edition]], but originally it worked more like the later [[FIX]] function for negative numbers. The manual for [[:basics:dartmouth:dartmouth2|Second Edition/CARDBASIC]] states it clearly: //"INT always operates by chopping off the fractional part".// It became the "true floor" function in BASIC only from [[:basics:dartmouth:dartmouth3|Dartmouth Third Edition]] onwards ((https://en.wikipedia.org/wiki/Dartmouth_BASIC#Third_Edition)).
===== Related keywords =====
/* Keywords that are often or always used along this one */
===== Similar keywords =====
/* Keywords with the same or similar functionality found in other versions of BASIC */
* [[FIX]]
* [[CINT]]
===== In other languages... =====
/* For parallels and comparisons with other modern-day languages */
===== References =====
/* If you used the ((citation)) syntax elsewhere in the text, they will appear under this section. But you can write some recommendations of books, magazines, etc */
/*
===== TAGS =====
Please use the syntax below for adding tags to this page, separated by spaces (use quotes for tags with spaces).
The most important tags to be used are, separated by groups:
- Statements | Commands | SpecialVariables | Operators
{{tag>tagName}}
*/
{{tag>Functions Conversion}}