Integer comparison: Difference between revisions
Content added Content deleted
m (→{{header|J}}: Improved grammar in commentary.) |
m (Spelling/grammar/aesthetics.) |
||
Line 1: | Line 1: | ||
⚫ | |||
{{task}} |
|||
{{basic data operation}} |
|||
⚫ | |||
=={{header|Ada}}== |
=={{header|Ada}}== |
||
Line 75: | Line 73: | ||
(t (format t "Cannot determine relevance between ~A and ~B!" a b))))) |
(t (format t "Cannot determine relevance between ~A and ~B!" a b))))) |
||
After hitting enter, the REPL is expecting the two numbers right away. You can enter the two numbers, and the result will print immediately. |
After hitting enter, the REPL is expecting the two numbers right away. You can enter the two numbers, and the result will print immediately. Alternatively, you can wrap this code in a function definition: |
||
(defun compare-integers () |
(defun compare-integers () |
||
Line 290: | Line 288: | ||
'''Interpreter:''' [[Perl]] 5.x |
'''Interpreter:''' [[Perl]] 5.x |
||
Separate tests for less than, greater than, and equals |
|||
sub test_num { |
sub test_num { |
||
Line 306: | Line 304: | ||
}; |
}; |
||
All three tests in one. |
All three tests in one. If $f is less than $s return -1, greater than return 1, equal to return 0 |
||
sub test_num { |
sub test_num { |