Integer comparison: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
(Add BCPL)
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(7 intermediate revisions by 5 users not shown)
Line 694:
 
=={{header|BASIC}}==
==={{header|Applesoft BASIC}}===
<syntaxhighlight lang="applesoftbasic">10 INPUT "ENTER TWO INTEGERS: "; A%, B%
20 A$(0) = "NOT "
30 PRINT A% " IS " A$(A% < B%) "LESS THAN " B%
40 PRINT A% " IS " A$(A% = B%) "EQUAL TO " B%
50 PRINT A% " IS " A$(A% > B%) "GREATER THAN " B%</syntaxhighlight>
 
==={{header|BaCon}}===
Line 702 ⟶ 708:
IF a = b THEN PRINT a, " is equal to ", b
IF a > b THEN PRINT a, " is greater than ", b</syntaxhighlight>
 
 
{{works with|QuickBasic|4.5}}
Line 713 ⟶ 718:
PRINT "b"</syntaxhighlight>
 
==={{header|Applesoft BASICBASIC256}}===
<syntaxhighlight lang="applesoftbasicfreebasic">10 INPUTinput "ENTERPlease TWOenter INTEGERSone integer: "; A%, B%x
input "and a second integer: ", y
20 A$(0) = "NOT "
30if PRINTx A%< "y ISthen "print A$(A%x; <" B%)is "LESSless THANthan "; B%y
40if PRINTx A%= "y ISthen "print A$(A%x; =" B%)is "EQUALequal TOto "; B%y
50if PRINTx A%> "y ISthen "print A$(A%x; >" B%)is "GREATERgreater THANthan "; B%y</syntaxhighlight>
 
==={{header|BBC BASIC}}===
<syntaxhighlight lang="bbcbasic"> INPUT "Enter two numbers separated by a comma: " a, b
CASE TRUE OF
WHEN a < b: PRINT ;a " is less than "; b
WHEN a = b: PRINT ;a " is equal to "; b
WHEN a > b: PRINT ;a " is greater than "; b
ENDCASE</syntaxhighlight>
 
==={{header|FreeBASIC}}===
<syntaxhighlight lang="freebasic">' FB 1.05.0 Win64
 
Dim As Integer x, y
Input "Please enter two integers, separated by a comma : ", x , y
 
If x < y Then
Print x; " is less than "; y
End If
 
If x = y Then
Print x; " is equal to "; y
End If
 
If x > y Then
Print x; " is greater than "; y
End If
 
Print
Print "Press any key to exit"
Sleep</syntaxhighlight>
 
==={{header|FutureBasic}}===
Note: Strictly speaking, it's preferable to use "==" when comparing integers as seen in this example. While the "=" sign will work as a comparison in most cases, technically it should be used for assignment, i.e. a = 3 when a is assigned the value of 3, as contrasted with a == 3, where the value of a is being compared with 3. FB will flag a warning when "==" is used to compare two single, doubles or floats since comparing real numbers can be inaccurate.
<syntaxhighlight lang="futurebasic">_window = 1
begin enum 1
_integer1Fld
_integer2Fld
_compareBtn
_messageLabel
end enum
 
local fn BuildWindow
window _window, @"Integer Comparison", (0,0,356,85)
 
textfield _integer1Fld,,, (20,44,112,21)
TextFieldSetPlaceholderString( _integer1Fld, @"Integer 1" )
 
textfield _integer2Fld,,, (140,44,112,21)
TextFieldSetPlaceholderString( _integer2Fld, @"Integer 2" )
 
button _compareBtn,,, @"Compare", (253,38,90,32)
 
textlabel _messageLabel,, (18,20,320,16)
ControlSetAlignment( _messageLabel, NSTextAlignmentCenter )
end fn
 
local fn DoDialog( ev as long, tag as long )
long int1, int2
 
select ( ev )
case _btnClick
select ( tag )
case _compareBtn
int1 = fn ControlIntegerValue( _integer1Fld )
int2 = fn ControlIntegerValue( _integer2Fld )
 
if ( int1 < int2 ) then textlabel _messageLabel, @"The first integer is less than the second integer."
if ( int1 == int2 ) then textlabel _messageLabel, @"The first integer is equal to the second integer."
if ( int1 > int2 ) then textlabel _messageLabel, @"The first integer is greater than the second integer."
 
end select
 
case _controlTextDidChange
textlabel _messageLabel, @""
end select
end fn
 
fn BuildWindow
 
on dialog fn DoDialog
 
HandleEvents</syntaxhighlight>
 
==={{header|Gambas}}===
<syntaxhighlight lang="gambas">Public Sub Form_Open()
Dim sIn As String = InputBox("Enter 2 integers seperated by a comma")
Dim iFirst, iSecond As Integer
 
iFirst = Val(Split(sIn)[0])
iSecond = Val(Split(sIn)[1])
 
If iFirst < iSecond Then Print iFirst & " is smaller than " & iSecond & gb.NewLine
If iFirst > iSecond Then Print iFirst & " is greater than " & iSecond & gb.NewLine
If iFirst = iSecond Then Print iFirst & " is equal to " & iSecond
 
End</syntaxhighlight>
Output:
<pre>
21 is greater than 18
</pre>
 
==={{header|IS-BASIC}}===
Line 744 ⟶ 849:
190 END SELECT</syntaxhighlight>
 
==={{header|BASIC256Liberty BASIC}}===
Verbose version:
<syntaxhighlight lang="freebasic">input "Please enter one integer: ", x
{{works with|Just BASIC}}
input "and a second integer: ", y
<syntaxhighlight lang="lb">input "Enter an integer for a. ";a
input "Enter an integer for b. ";b
 
'a=int(a):b=int(b) ???
if x < y then print x; " is less than "; y
print "Conditional evaluation."
if x = y then print x; " is equal to "; y
if x > ya<b then print x;"a<b " is; greatera than; "; y</syntaxhighlight> " ; b
if a=b then print "a=b " ; a ; " = " ; b
if a>b then print "a>b " ; a ; " > " ; b
 
print "Select case evaluation."
select case
case (a<b)
print "a<b " ; a ; " < " ; b
case (a=b)
print "a=b " ; a ; " = " ; b
case (a>b)
print "a>b " ; a ; " > " ; b
end select
</syntaxhighlight>
 
Concise:
<syntaxhighlight lang="lb">input "Enter an integer for a. ";a
input "Enter an integer for b. ";b
 
for i = 1 to 3
op$=word$("< = >", i)
if eval("a"+op$+"b") then print "a"+op$+"b " ; a;" ";op$;" ";b
next
</syntaxhighlight>
 
==={{header|OxygenBasic}}===
Line 769 ⟶ 899:
loop
</syntaxhighlight>
 
==={{header|PureBasic}}===
<syntaxhighlight lang="purebasic">If OpenConsole()
 
Print("Enter an integer: ")
x.i = Val(Input())
Print("Enter another integer: ")
y.i = Val(Input())
 
If x < y
Print( "The first integer is less than the second integer.")
ElseIf x = y
Print("The first integer is equal to the second integer.")
ElseIf x > y
Print("The first integer is greater than the second integer.")
EndIf
 
Print(#CRLF$ + #CRLF$ + "Press ENTER to exit")
Input()
CloseConsole()
EndIf</syntaxhighlight>
 
==={{header|QBasic}}===
Line 776 ⟶ 927:
IF x = y THEN PRINT x; " is equal to "; y
IF x > y THEN PRINT x; " is greater than "; y</syntaxhighlight>
 
==={{header|Run BASIC}}===
<syntaxhighlight lang="runbasic">input "1st number:"; n1
input "2nd number:"; n2
 
if n1 < n2 then print "1st number ";n1;" is less than 2nd number";n2
if n1 > n2 then print "1st number ";n1;" is greater than 2nd number";n2
if n1 = n2 then print "1st number ";n1;" is equal to 2nd number";n2</syntaxhighlight>
 
==={{header|TI-83 BASIC}}===
<syntaxhighlight lang="ti83b">Prompt A,B
If A<B: Disp "A SMALLER B"
If A>B: Disp "A GREATER B"
If A=B: Disp "A EQUAL B"</syntaxhighlight>
 
==={{header|TI-89 BASIC}}===
<syntaxhighlight lang="ti89b">Local a, b, result
Prompt a, b
If a < b Then
"<" → result
ElseIf a = b Then
"=" → result
ElseIf a > b Then
">" → result
Else
"???" → result
EndIf
Disp string(a) & " " & result & " " & string(b)</syntaxhighlight>
 
==={{Header|Tiny BASIC}}===
{{works with|TinyBasic}}
Some implementations of Tiny BASIC use <code>,</code> instead of <code>;</code> for concatenation of print items.
<syntaxhighlight lang="basic">10 REM Integer comparison
20 PRINT "Enter a number"
30 INPUT A
40 PRINT "Enter another number"
50 INPUT B
60 IF A < B THEN PRINT A;" is less than ";B
70 IF A > B THEN PRINT A;" is greater than ";B
80 IF A = B THEN PRINT A;" is equal to ";B
90 END</syntaxhighlight>
 
==={{header|True BASIC}}===
Line 785 ⟶ 977:
IF x > y THEN PRINT x; " is greater than "; y
END</syntaxhighlight>
 
==={{header|VBA}}===
<syntaxhighlight lang="vb">Public Sub integer_comparison()
first_integer = CInt(InputBox("Give me an integer."))
second_integer = CInt(InputBox("Give me another integer."))
Debug.Print IIf(first_integer < second_integer, "first integer is smaller than second integer", "first integer is not smaller than second integer")
Debug.Print IIf(first_integer = second_integer, "first integer is equal to second integer", "first integer is not equal to second integer")
Debug.Print IIf(first_integer > second_integer, "first integer is bigger than second integer", "first integer is not bigger than second integer")
End Sub</syntaxhighlight>
 
==={{header|VBScript}}===
<syntaxhighlight lang="vb">
option explicit
 
function eef( b, r1, r2 )
if b then
eef = r1
else
eef = r2
end if
end function
 
dim a, b
wscript.stdout.write "First integer: "
a = cint(wscript.stdin.readline) 'force to integer
 
wscript.stdout.write "Second integer: "
b = cint(wscript.stdin.readline) 'force to integer
 
wscript.stdout.write "First integer is "
if a < b then wscript.stdout.write "less than "
if a = b then wscript.stdout.write "equal to "
if a > b then wscript.stdout.write "greater than "
wscript.echo "Second integer."
 
wscript.stdout.write "First integer is " & _
eef( a < b, "less than ", _
eef( a = b, "equal to ", _
eef( a > b, "greater than ", vbnullstring ) ) ) & "Second integer."
</syntaxhighlight>
 
==={{header|Visual Basic .NET}}===
'''Platform:''' [[.NET]]
 
{{works with|Visual Basic .NET|9.0+}}
<syntaxhighlight lang="vbnet">Sub Main()
 
Dim a = CInt(Console.ReadLine)
Dim b = CInt(Console.ReadLine)
 
'Using if statements
If a < b Then Console.WriteLine("a is less than b")
If a = b Then Console.WriteLine("a equals b")
If a > b Then Console.WriteLine("a is greater than b")
 
'Using Case
Select Case a
Case Is < b
Console.WriteLine("a is less than b")
Case b
Console.WriteLine("a equals b")
Case Is > b
Console.WriteLine("a is greater than b")
End Select
 
End Sub</syntaxhighlight>
 
==={{header|Yabasic}}===
Line 793 ⟶ 1,051:
if x > y then print x, " is greater than ", y : fi</syntaxhighlight>
 
==={{Headerheader|TinyZX BASICSpectrum Basic}}===
<syntaxhighlight lang="tinybasiczxbasic">PRINT10 INPUT "Enter two integers: ";a;" number";b
20 PRINT a;" is ";("less than " AND (a<b));("equal to " AND (a=b));("greather than " AND (a>b));b</syntaxhighlight>
INPUT A
PRINT "Enter another number"
INPUT B
IF A < B THEN PRINT A," is less than ",B
IF A > B THEN PRINT A," is greater than ",B
IF A = B THEN PRINT A," is equal to ",B</syntaxhighlight>
 
=={{header|Batch File}}==
Line 819 ⟶ 1,072:
B: 3
5 is greater than 3</pre>
 
=={{header|BBC BASIC}}==
<syntaxhighlight lang="bbcbasic"> INPUT "Enter two numbers separated by a comma: " a, b
CASE TRUE OF
WHEN a < b: PRINT ;a " is less than "; b
WHEN a = b: PRINT ;a " is equal to "; b
WHEN a > b: PRINT ;a " is greater than "; b
ENDCASE</syntaxhighlight>
 
=={{header|bc}}==
Line 1,509 ⟶ 1,754:
Invoke from within Emacs Lisp (or e.g., with <code>M-:</code>) as <code>(integer-comparison 12 42)</code>
Or, use <code>M-x integer-comparison RET</code> and you'll be prompted for the two numbers.
 
=={{header|EMal}}==
<syntaxhighlight lang="emal">
fun main = int by List args
int a, b
if args.length > 1
a = int!args[0]
b = int!args[1]
else
a = ask(int, "Enter the first integer ")
b = ask(int, "Enter the second integer ")
end
writeLine("=== a <> b is " + (a <> b) + " ===")
if a < b do writeLine(a + " < " + b) end
if a == b do writeLine(a + " == " + b) end
if a > b do writeLine(a + " > " + b) end
return 0
end
exit main(Runtime.args)
</syntaxhighlight>
{{out}}
<pre>
emal.exe Org\RosettaCode\IntegerComparison.emal
Enter the first integer 42
Enter the second integer 64
=== a <> b is -1 ===
42 < 64
</pre>
 
=={{header|Erlang}}==
Line 1,711 ⟶ 1,984:
 
end program compare</syntaxhighlight>
 
=={{header|FreeBASIC}}==
<syntaxhighlight lang="freebasic">' FB 1.05.0 Win64
 
Dim As Integer x, y
Input "Please enter two integers, separated by a comma : ", x , y
 
If x < y Then
Print x; " is less than "; y
End If
 
If x = y Then
Print x; " is equal to "; y
End If
 
If x > y Then
Print x; " is greater than "; y
End If
 
Print
Print "Press any key to exit"
Sleep</syntaxhighlight>
 
=={{header|friendly interactive shell}}==
Line 1,767 ⟶ 2,018:
println( "$a is $c $b." )</syntaxhighlight>
 
=={{header|FutureBasicFōrmulæ}}==
Note: Strictly speaking, it's preferable to use "==" when comparing integers as seen in this example. While the "=" sign will work as a comparison in most cases, technically it should be used for assignment, i.e. a = 3 when a is assigned the value of 3, as contrasted with a == 3, where the value of a is being compared with 3. FB will flag a warning when "==" is used to compare two single, doubles or floats since comparing real numbers can be inaccurate.
<syntaxhighlight lang="futurebasic">_window = 1
begin enum 1
_integer1Fld
_integer2Fld
_compareBtn
_messageLabel
end enum
 
{{FormulaeEntry|page=https://formulae.org/?script=examples/Integer_comparison}}
local fn BuildWindow
window _window, @"Integer Comparison", (0,0,356,85)
 
'''Solution'''
textfield _integer1Fld,,, (20,44,112,21)
TextFieldSetPlaceholderString( _integer1Fld, @"Integer 1" )
 
Fōrmulæ has an intrinsic expression for [[wp:Three-way_comparison|three-way comparison]] that works for integers and other types (decimal and rational numbers, strings, time expressions, etc). It returns expressions that flag one of the three possible results.
textfield _integer2Fld,,, (140,44,112,21)
TextFieldSetPlaceholderString( _integer2Fld, @"Integer 2" )
 
[[File:Fōrmulæ - Integer comparison 01.png]]
button _compareBtn,,, @"Compare", (253,38,90,32)
 
[[File:Fōrmulæ - Integer comparison 02.png]]
textlabel _messageLabel,, (18,20,320,16)
ControlSetAlignment( _messageLabel, NSTextAlignmentCenter )
end fn
 
However, a simple function can be written for the requirement:
local fn DoDialog( ev as long, tag as long )
long int1, int2
 
[[File:Fōrmulæ - Integer comparison 03.png]]
select ( ev )
case _btnClick
select ( tag )
case _compareBtn
int1 = fn ControlIntegerValue( _integer1Fld )
int2 = fn ControlIntegerValue( _integer2Fld )
 
[[File:Fōrmulæ - Integer comparison 04.png]]
if ( int1 < int2 ) then textlabel _messageLabel, @"The first integer is less than the second integer."
if ( int1 == int2 ) then textlabel _messageLabel, @"The first integer is equal to the second integer."
if ( int1 > int2 ) then textlabel _messageLabel, @"The first integer is greater than the second integer."
 
[[File:Fōrmulæ - Integer comparison 05.png]]
end select
 
case _controlTextDidChange
textlabel _messageLabel, @""
end select
end fn
 
fn BuildWindow
 
on dialog fn DoDialog
 
HandleEvents</syntaxhighlight>
 
=={{header|Fōrmulæ}}==
 
Fōrmulæ programs are not textual, visualization/edition of programs is done showing/manipulating structures but not text. Moreover, there can be multiple visual representations of the same program. Even though it is possible to have textual representation &mdash;i.e. XML, JSON&mdash; they are intended for storage and transfer purposes more than visualization and edition.
 
Programs in Fōrmulæ are created/edited online in its [https://formulae.org website], However they run on execution servers. By default remote servers are used, but they are limited in memory and processing power, since they are intended for demonstration and casual use. A local server can be downloaded and installed, it has no limitations (it runs in your own computer). Because of that, example programs can be fully visualized and edited, but some of them will not run if they require a moderate or heavy computation/memory resources, and no local server is being used.
 
In '''[https://formulae.org/?example=Integer_comparison this]''' page you can see the program(s) related to this task and their results.
 
=={{header|Gambas}}==
<syntaxhighlight lang="gambas">Public Sub Form_Open()
Dim sIn As String = InputBox("Enter 2 integers seperated by a comma")
Dim iFirst, iSecond As Integer
 
iFirst = Val(Split(sIn)[0])
iSecond = Val(Split(sIn)[1])
 
If iFirst < iSecond Then Print iFirst & " is smaller than " & iSecond & gb.NewLine
If iFirst > iSecond Then Print iFirst & " is greater than " & iSecond & gb.NewLine
If iFirst = iSecond Then Print iFirst & " is equal to " & iSecond
 
End</syntaxhighlight>
Output:
<pre>
21 is greater than 18
</pre>
 
=={{header|Go}}==
Line 2,196 ⟶ 2,389:
{compare 1 1}
-> 1 is equal to 1
</syntaxhighlight>
 
=={{header|Lang}}==
<syntaxhighlight lang="lang">
fn.print(Enter a:\s)
$a = fn.int(fn.input())
 
fn.print(Enter b:\s)
$b = fn.int(fn.input())
 
if($a < $b) {
fn.println($a is less than $b)
}elif($a > $b) {
fn.println($a is greater than $b)
}elif($a === $b) {
fn.println($a is equals to $b)
}
</syntaxhighlight>
 
Line 2,215 ⟶ 2,425:
Number 1 is the same as Number 2
Number 1 is not greater than Number 2</pre>
 
=={{header|Liberty BASIC}}==
Verbose version:
<syntaxhighlight lang="lb">input "Enter an integer for a. ";a
input "Enter an integer for b. ";b
 
'a=int(a):b=int(b) ???
print "Conditional evaluation."
if a<b then print "a<b " ; a ; " < " ; b
if a=b then print "a=b " ; a ; " = " ; b
if a>b then print "a>b " ; a ; " > " ; b
 
print "Select case evaluation."
select case
case (a<b)
print "a<b " ; a ; " < " ; b
case (a=b)
print "a=b " ; a ; " = " ; b
case (a>b)
print "a>b " ; a ; " > " ; b
end select
</syntaxhighlight>
 
Concise:
<syntaxhighlight lang="lb">input "Enter an integer for a. ";a
input "Enter an integer for b. ";b
 
for i = 1 to 3
op$=word$("< = >", i)
if eval("a"+op$+"b") then print "a"+op$+"b " ; a;" ";op$;" ";b
next
</syntaxhighlight>
 
=={{header|LIL}}==
Line 2,886 ⟶ 3,063:
Pop $0
FunctionEnd
</syntaxhighlight>
 
=={{header|Nu}}==
<syntaxhighlight lang="nu">
[First Second] | each {input $"($in) integer: "| into int} | [
[($in.0 < $in.1) "less than"]
[($in.0 == $in.1) "equal to"]
[($in.0 > $in.1) "greater than"]
] | each {if $in.0 {$"The first integer is ($in.1) the second integer."}} | str join "\n"
</syntaxhighlight>
 
Line 3,264 ⟶ 3,450:
Write-Host $a is greater than $b`.
}</syntaxhighlight>
 
=={{header|PureBasic}}==
<syntaxhighlight lang="purebasic">If OpenConsole()
 
Print("Enter an integer: ")
x.i = Val(Input())
Print("Enter another integer: ")
y.i = Val(Input())
 
If x < y
Print( "The first integer is less than the second integer.")
ElseIf x = y
Print("The first integer is equal to the second integer.")
ElseIf x > y
Print("The first integer is greater than the second integer.")
EndIf
 
Print(#CRLF$ + #CRLF$ + "Press ENTER to exit")
Input()
CloseConsole()
EndIf</syntaxhighlight>
 
=={{header|Python}}==
Line 3,708 ⟶ 3,873:
# I hope you can figure this out
puts "#{a} is #{dispatch[a<=>b]} #{b}"</syntaxhighlight>
 
=={{header|Run BASIC}}==
<syntaxhighlight lang="runbasic">input "1st number:"; n1
input "2nd number:"; n2
 
if n1 < n2 then print "1st number ";n1;" is less than 2nd number";n2
if n1 > n2 then print "1st number ";n1;" is greater than 2nd number";n2
if n1 = n2 then print "1st number ";n1;" is equal to 2nd number";n2</syntaxhighlight>
 
=={{header|Rust}}==
Line 4,167 ⟶ 4,324:
% foreach {o s} {< "less than" > "greater than" == equal} {if [list $i $o $j] {puts "$i is $s $j"}}
5 is greater than 4</syntaxhighlight>
 
=={{header|TI-83 BASIC}}==
<syntaxhighlight lang="ti83b">Prompt A,B
If A<B: Disp "A SMALLER B"
If A>B: Disp "A GREATER B"
If A=B: Disp "A EQUAL B"</syntaxhighlight>
 
=={{header|TI-89 BASIC}}==
 
<syntaxhighlight lang="ti89b">Local a, b, result
Prompt a, b
If a < b Then
"<" → result
ElseIf a = b Then
"=" → result
ElseIf a > b Then
">" → result
Else
"???" → result
EndIf
Disp string(a) & " " & result & " " & string(b)</syntaxhighlight>
 
=={{header|Toka}}==
Line 4,332 ⟶ 4,468:
}
</syntaxhighlight>
 
=={{header|VBA}}==
<syntaxhighlight lang="vb">Public Sub integer_comparison()
first_integer = CInt(InputBox("Give me an integer."))
second_integer = CInt(InputBox("Give me another integer."))
Debug.Print IIf(first_integer < second_integer, "first integer is smaller than second integer", "first integer is not smaller than second integer")
Debug.Print IIf(first_integer = second_integer, "first integer is equal to second integer", "first integer is not equal to second integer")
Debug.Print IIf(first_integer > second_integer, "first integer is bigger than second integer", "first integer is not bigger than second integer")
End Sub</syntaxhighlight>
 
=={{header|VBScript}}==
Based on the BASIC
=====Implementation=====
<syntaxhighlight lang="vb">
option explicit
 
function eef( b, r1, r2 )
if b then
eef = r1
else
eef = r2
end if
end function
 
dim a, b
wscript.stdout.write "First integer: "
a = cint(wscript.stdin.readline) 'force to integer
 
wscript.stdout.write "Second integer: "
b = cint(wscript.stdin.readline) 'force to integer
 
wscript.stdout.write "First integer is "
if a < b then wscript.stdout.write "less than "
if a = b then wscript.stdout.write "equal to "
if a > b then wscript.stdout.write "greater than "
wscript.echo "Second integer."
 
wscript.stdout.write "First integer is " & _
eef( a < b, "less than ", _
eef( a = b, "equal to ", _
eef( a > b, "greater than ", vbnullstring ) ) ) & "Second integer."
</syntaxhighlight>
 
=={{header|Visual Basic .NET}}==
'''Platform:''' [[.NET]]
 
{{works with|Visual Basic .NET|9.0+}}
<syntaxhighlight lang="vbnet">Sub Main()
 
Dim a = CInt(Console.ReadLine)
Dim b = CInt(Console.ReadLine)
 
'Using if statements
If a < b Then Console.WriteLine("a is less than b")
If a = b Then Console.WriteLine("a equals b")
If a > b Then Console.WriteLine("a is greater than b")
 
'Using Case
Select Case a
Case Is < b
Console.WriteLine("a is less than b")
Case b
Console.WriteLine("a equals b")
Case Is > b
Console.WriteLine("a is greater than b")
End Select
 
End Sub</syntaxhighlight>
 
=={{header|Wart}}==
Line 4,412 ⟶ 4,480:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">import "io" for Stdin, Stdout
 
System.print("Enter anything other than a number to quit at any time.\n")
Line 4,501 ⟶ 4,569:
greater
</pre>
 
=={{header|ZX Spectrum Basic}}==
<syntaxhighlight lang="zxbasic">10 INPUT "Enter two integers: ";a;" ";b
20 PRINT a;" is ";("less than " AND (a<b));("equal to " AND (a=b));("greather than " AND (a>b));b</syntaxhighlight>
9,476

edits