Skip to content

Commit fd0df89

Browse files
authored
Update 734-math-int.markdown
1 parent 331f651 commit fd0df89

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

_build/reference/734-math-int.markdown

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,27 @@
44
55
Rounds x downwards to the nearest integer.
66

7-
I think /1 will convert a number to an integer in less keystrokes than INT, they both round down for positives and up for negatives.
7+
x\1 will convert a x to an integer in less keystrokes than INT, they both round down for positives and up for negatives.
88
In other words, they both drop the fractional part of the number.
99

10-
~~~
11-
10+
```
1211
'INT or alternate.bas 2016-03-06 SmallBASIC 0.12.2 [B+=MGA]
13-
'I think number\\1 is eqivalent to INT(number) in less keystrokes
12+
'I think number\1 is eqivalent to INT(number) in less keystrokes
1413
' both of these convert a number to an integer and both round down to do it.
1514
for i = 1 to 20
1615
'which coin should I use
17-
if rnd<.5 then TF=int(rnd*2) else TF=rnd*2\\1
16+
if rnd<.5 then TF=int(rnd*2) else TF=rnd*2\1
1817
? TF,
1918
if TF then ? "It is true now."; else ? "Now it's false.";
2019
?spc(3)+"press a key or click for next..."
2120
next
2221
for i=0 to -10 step -1 'they seem to behave the same for negatives too
2322
test=i+rnd
24-
? "test = ";test
25-
? "test\\1 " ;test\\1
26-
? "int(test) ";int(test)
23+
? " test = ";test
24+
? " test\1 = " ;test\1
25+
? "int(test) = ";int(test)
2726
?
2827
next
29-
pause
30-
31-
~~~
28+
```
3229

3330

0 commit comments

Comments
 (0)