task_url
stringlengths
30
116
task_name
stringlengths
2
86
task_description
stringlengths
0
14.4k
language_url
stringlengths
2
53
language_name
stringlengths
1
52
code
stringlengths
0
61.9k
http://rosettacode.org/wiki/Infinity
Infinity
Task Write a function which tests if infinity is supported for floating point numbers (this step should be omitted for languages where the language specification already demands the existence of infinity, e.g. by demanding IEEE numbers), and if so, returns positive infinity.   Otherwise, return the largest possible po...
#ZX_Spectrum_Basic
ZX Spectrum Basic
PRINT 1/0
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#Python
Python
while(True): x = input("What is your age? ") print(x)
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#R
R
lines <- readLines("file.txt")
http://rosettacode.org/wiki/Josephus_problem
Josephus problem
Josephus problem is a math puzzle with a grim description: n {\displaystyle n} prisoners are standing on a circle, sequentially numbered from 0 {\displaystyle 0} to n − 1 {\displaystyle n-1} . An executioner walks along the circle, starting from prisoner 0 {\displaystyle 0} , removing eve...
#SequenceL
SequenceL
main := josephus(41, 3);   josephus(n, k) := josephusHelper(n, k, 1, 0);   josephusHelper(n, k, i, r) := r when i > n else josephusHelper(n, k, i + 1, (r + k) mod i);
http://rosettacode.org/wiki/I_before_E_except_after_C
I before E except after C
The phrase     "I before E, except after C"     is a widely known mnemonic which is supposed to help when spelling English words. Task Using the word list from   http://wiki.puzzlers.org/pub/wordlists/unixdict.txt, check if the two sub-clauses of the phrase are plausible individually:   "I before E when not pre...
#Erlang
Erlang
  -module(cei). -export([plaus/0,count/3]).   plaus() -> {ok,Words} = file:read_file("unixdict.txt"), ...
http://rosettacode.org/wiki/Increment_a_numerical_string
Increment a numerical string
Task Increment a numerical string.
#F.23
F#
let next = string( int( "1234" ) + 1 )
http://rosettacode.org/wiki/Increment_a_numerical_string
Increment a numerical string
Task Increment a numerical string.
#Factor
Factor
"1234" string>number 1 + number>string
http://rosettacode.org/wiki/Integer_comparison
Integer comparison
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#ECL
ECL
  CompareThem(INTEGER A,INTEGER B) := FUNCTION Result  := A <=> B; STRING ResultText := CASE (Result,1 => 'is greater than', 0 => 'is equal to','is less than'); RETURN A + ' ' + TRIM(ResultText) + ' ' + B; END;   CompareThem(1,2); //Shows "1 is less than 2" CompareThem(2,2); //Shows "2 is equal to 2" Co...
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#Oforth
Oforth
"filename" load
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#Ol
Ol
  (import (otus random!))  
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#ooRexx
ooRexx
 ::requires "regex.cls"
http://rosettacode.org/wiki/IBAN
IBAN
This page uses content from Wikipedia. The original article was at IBAN. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) The   International Bank Account Number (IBAN)   is an internationally agree...
#Factor
Factor
USING: assocs combinators.short-circuit formatting kernel math math.parser regexp sequences sets qw unicode ; IN: rosetta-code.iban   <PRIVATE   CONSTANT: countries H{ { 15 qw{ NO } } { 16 qw{ BE } } { 18 qw{ DK FO FI GL NL } } { 19 qw{ MK SI } } { 20 qw{ AT BA EE KZ LT LU } } { 21 qw{ CR HR LV ...
http://rosettacode.org/wiki/Humble_numbers
Humble numbers
Humble numbers are positive integers which have   no   prime factors   >   7. Humble numbers are also called   7-smooth numbers,   and sometimes called   highly composite, although this conflicts with another meaning of   highly composite numbers. Another way to express the above is: humble = 2i × 3j × 5k...
#Nim
Nim
import sets, strformat     proc min[T](s: HashSet[T]): T = ## Return the minimal value in a set. if s.card == 0: raise newException(ValueError, "set is empty.") result = T.high for n in s: if n < result: result = n     iterator humbleNumbers(): Positive = ## Yield the successive humble numbers. var ...
http://rosettacode.org/wiki/Humble_numbers
Humble numbers
Humble numbers are positive integers which have   no   prime factors   >   7. Humble numbers are also called   7-smooth numbers,   and sometimes called   highly composite, although this conflicts with another meaning of   highly composite numbers. Another way to express the above is: humble = 2i × 3j × 5k...
#Pascal
Pascal
  {$IFDEF FPC} {$MODE DELPHI} {$OPTIMIZATION ON,ALL} {$CODEALIGN proc=32,loop=1} {$ALIGN 16} {$ELSE} {$APPTYPE CONSOLE} {$ENDIF} uses sysutils; const //PlInit(4); <= maxPrimFakCnt+1 maxPrimFakCnt = 3;//3,7,11 to keep data 8-Byte aligned minElemCnt = 10; type tPrimList = array of NativeUint; tn...
http://rosettacode.org/wiki/Identity_matrix
Identity matrix
Task Build an   identity matrix   of a size known at run-time. An identity matrix is a square matrix of size n × n, where the diagonal elements are all 1s (ones), and all the other elements are all 0s (zeroes). I n = [ 1 0 0 ⋯ 0 0 1 0 ⋯ 0 0 0 1 ⋯ 0 ⋮ ⋮ ⋮ ⋱ ...
#Clojure
Clojure
'( (0 1) (2 3) )  
http://rosettacode.org/wiki/Image_noise
Image noise
Generate a random black and white   320x240   image continuously, showing FPS (frames per second). A sample image
#Ruby
Ruby
require 'rubygems' require 'gl' require 'glut'   W, H = 320, 240 SIZE = W * H   Glut.glutInit ARGV Glut.glutInitWindowSize W, H   Glut.glutIdleFunc lambda { i = Time.now noise = (1..SIZE).map { rand > 0.5 ? 0xFFFFFFFF : 0xFF000000 }.pack("I*")   Gl.glClear Gl::GL_COLOR_BUFFER_BIT Gl.glDrawPixels W, H, Gl::GL_RG...
http://rosettacode.org/wiki/Image_noise
Image noise
Generate a random black and white   320x240   image continuously, showing FPS (frames per second). A sample image
#Run_BASIC
Run BASIC
begSec = time$("seconds") graphic #g, 320,240 tics = 320 * 240 for i = 1 to tics x = int((rnd(1) * 320) + 1) y = int((rnd(1) * 240) + 1) if int(x mod 2) then #g "color black ; set "; x; " "; y else #g "color white ; set "; x; " "; y next i endSec = time$("seconds") totSec = endSec - begSec print "Seconds...
http://rosettacode.org/wiki/Integer_sequence
Integer sequence
Task Create a program that, when run, would display all integers from   1   to   ∞   (or any relevant implementation limit),   in sequence   (i.e.   1, 2, 3, 4, etc)   if given enough time. An example may not be able to reach arbitrarily-large numbers based on implementations limits.   For example, if integer...
#LLVM
LLVM
; This is not strictly LLVM, as it uses the C library function "printf". ; LLVM does not provide a way to print values, so the alternative would be ; to just load the string into memory, and that would be boring.   ; Additional comments have been inserted, as well as changes made from the output produced by clang such ...
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#Racket
Racket
  #lang racket (copy-port (current-input-port) (current-output-port))  
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#Raku
Raku
rebol [ Title: "Basic Input Loop" URL: http://rosettacode.org/wiki/Basic_input_loop ]   ; Slurp the whole file in: x: read %file.txt   ; Bring the file in by lines: x: read/lines %file.txt   ; Read in first 10 lines: x: read/lines/part %file.txt 10   ; Read data a line at a time: f: open/lines %file.txt while [not ta...
http://rosettacode.org/wiki/Josephus_problem
Josephus problem
Josephus problem is a math puzzle with a grim description: n {\displaystyle n} prisoners are standing on a circle, sequentially numbered from 0 {\displaystyle 0} to n − 1 {\displaystyle n-1} . An executioner walks along the circle, starting from prisoner 0 {\displaystyle 0} , removing eve...
#Sidef
Sidef
func josephus(n, k) { var prisoners = @^n while (prisoners.len > 1) { prisoners.rotate!(k - 1).shift } return prisoners[0] }
http://rosettacode.org/wiki/I_before_E_except_after_C
I before E except after C
The phrase     "I before E, except after C"     is a widely known mnemonic which is supposed to help when spelling English words. Task Using the word list from   http://wiki.puzzlers.org/pub/wordlists/unixdict.txt, check if the two sub-clauses of the phrase are plausible individually:   "I before E when not pre...
#Factor
Factor
USING: combinators formatting generalizations io.encodings.utf8 io.files kernel literals math prettyprint regexp sequences ; IN: rosetta-code.i-before-e   : correct ( #correct #incorrect rule-str -- ) pprint " is correct for %d and incorrect for %d.\n" printf ;   : plausibility ( #correct #incorrect -- str ) 2 ...
http://rosettacode.org/wiki/Increment_a_numerical_string
Increment a numerical string
Task Increment a numerical string.
#Fantom
Fantom
  fansh> a := "123" 123 fansh> (a.toInt + 1).toStr 124  
http://rosettacode.org/wiki/Increment_a_numerical_string
Increment a numerical string
Task Increment a numerical string.
#Forth
Forth
: >string ( d -- addr n ) dup >r dabs <# #s r> sign #> ;   : inc-string ( addr -- ) dup count number? not abort" invalid number" 1 s>d d+ >string rot place ;
http://rosettacode.org/wiki/Integer_comparison
Integer comparison
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#EDSAC_order_code
EDSAC order code
[ Integer comparison ==================   A program for the EDSAC   Illustrates the use of the E (branch on accumulator sign bit clear) and G (branch on accumulator sign bit set) orders   The integers to be tested, x and y, should be stored in addresses 13@ and 14@   Output: the program causes the...
http://rosettacode.org/wiki/Integer_comparison
Integer comparison
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Efene
Efene
compare = fn (A, B) { if A == B { io.format("~p equals ~p~n", [A, B]) } else { ok }   if A < B { io.format("~p is less than ~p~n", [A, B]) } else { ok }   if A > B { io.format("~p is greater than ~p~n", [A, B]) } else { ok...
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#OpenEdge.2FProgress
OpenEdge/Progress
{file.i}
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#Openscad
Openscad
//Include and run the file foo.scad include <foo.scad>;   //Import modules and functions, but do not execute use <bar.scad>;
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#PARI.2FGP
PARI/GP
#!/usr/bin/perl do "include.pl"; # Utilize source from another file sayhello();
http://rosettacode.org/wiki/IBAN
IBAN
This page uses content from Wikipedia. The original article was at IBAN. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) The   International Bank Account Number (IBAN)   is an internationally agree...
#Forth
Forth
include lib/ulcase.4th \ for S>UPPER include lib/triple.4th \ for UT/MOD include lib/cstring.4th \ for C/STRING include lib/todbl.4th \ for S>DOUBLE   0 constant ud>t \ convert unsigned double to triple 88529281 constant 97^4 ...
http://rosettacode.org/wiki/Humble_numbers
Humble numbers
Humble numbers are positive integers which have   no   prime factors   >   7. Humble numbers are also called   7-smooth numbers,   and sometimes called   highly composite, although this conflicts with another meaning of   highly composite numbers. Another way to express the above is: humble = 2i × 3j × 5k...
#Perl
Perl
use strict; use warnings; use List::Util 'min';   #use bigint # works, but slow use Math::GMPz; # this module gives roughly 16x speed-up   sub humble_gen { my @s = ([1], [1], [1], [1]); my @m = (2, 3, 5, 7); @m = map { Math::GMPz->new($_) } @m; # comment out to NOT use Math::GMPz   return sub { ...
http://rosettacode.org/wiki/Identity_matrix
Identity matrix
Task Build an   identity matrix   of a size known at run-time. An identity matrix is a square matrix of size n × n, where the diagonal elements are all 1s (ones), and all the other elements are all 0s (zeroes). I n = [ 1 0 0 ⋯ 0 0 1 0 ⋯ 0 0 0 1 ⋯ 0 ⋮ ⋮ ⋮ ⋱ ...
#Common_Lisp
Common Lisp
(defun make-identity-matrix (n) (let ((array (make-array (list n n) :initial-element 0))) (loop for i below n do (setf (aref array i i) 1)) array))  
http://rosettacode.org/wiki/Image_noise
Image noise
Generate a random black and white   320x240   image continuously, showing FPS (frames per second). A sample image
#Scala
Scala
  import java.awt.event.{ActionEvent, ActionListener} import swing.{Panel, MainFrame, SimpleSwingApplication} import javax.swing.Timer import java.awt.{Font, Color, Graphics2D, Dimension}   object ImageNoise extends SimpleSwingApplication { var delay_ms = 2 var framecount = 0 var fps = 0   def top = new MainFra...
http://rosettacode.org/wiki/Integer_sequence
Integer sequence
Task Create a program that, when run, would display all integers from   1   to   ∞   (or any relevant implementation limit),   in sequence   (i.e.   1, 2, 3, 4, etc)   if given enough time. An example may not be able to reach arbitrarily-large numbers based on implementations limits.   For example, if integer...
#Lua
Lua
  i = 1   -- in the event that the number inadvertently wraps around, -- stop looping - this is unlikely with Lua's default underlying -- number type (double), but on platform without double -- the C type used for numbers can be changed while i > 0 do print( i ) i = i + 1 end  
http://rosettacode.org/wiki/Integer_sequence
Integer sequence
Task Create a program that, when run, would display all integers from   1   to   ∞   (or any relevant implementation limit),   in sequence   (i.e.   1, 2, 3, 4, etc)   if given enough time. An example may not be able to reach arbitrarily-large numbers based on implementations limits.   For example, if integer...
#M2000_Interpreter
M2000 Interpreter
  \\ easy way a=1@ \\ Def statement defines one time (second pass produce error) Rem : Def Decimal a=1 Rem : Def a as decimal=1 \\ Global shadow any global with same name, but not local \\ globals can change type, local can't change \\ to assign value to global need <= \\ Symbol = always make local variables (and shad...
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#REBOL
REBOL
rebol [ Title: "Basic Input Loop" URL: http://rosettacode.org/wiki/Basic_input_loop ]   ; Slurp the whole file in: x: read %file.txt   ; Bring the file in by lines: x: read/lines %file.txt   ; Read in first 10 lines: x: read/lines/part %file.txt 10   ; Read data a line at a time: f: open/lines %file.txt while [not ta...
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#REXX
REXX
do while stream(stdin, "State") <> "NOTREADY" call charout ,charin(stdin) end
http://rosettacode.org/wiki/Josephus_problem
Josephus problem
Josephus problem is a math puzzle with a grim description: n {\displaystyle n} prisoners are standing on a circle, sequentially numbered from 0 {\displaystyle 0} to n − 1 {\displaystyle n-1} . An executioner walks along the circle, starting from prisoner 0 {\displaystyle 0} , removing eve...
#Swift
Swift
class Josephus {   class func lineUp(#numberOfPeople:Int) -> [Int] { var people = [Int]() for (var i = 0; i < numberOfPeople; i++) { people.append(i) } return people }   class func execute(#numberOfPeople:Int, spacing:Int) -> Int { var killIndex = 0 ...
http://rosettacode.org/wiki/I_before_E_except_after_C
I before E except after C
The phrase     "I before E, except after C"     is a widely known mnemonic which is supposed to help when spelling English words. Task Using the word list from   http://wiki.puzzlers.org/pub/wordlists/unixdict.txt, check if the two sub-clauses of the phrase are plausible individually:   "I before E when not pre...
#Fortran
Fortran
  !-*- mode: compilation; default-directory: "/tmp/" -*- !Compilation started at Sat May 18 22:19:19 ! !a=./F && make $a && $a < unixdict.txt !f95 -Wall -ffree-form F.F -o F ! ie ei cie cei ! 490 230 24 13 ! [^c]ie plausible ! cei implausible ! ...
http://rosettacode.org/wiki/Increment_a_numerical_string
Increment a numerical string
Task Increment a numerical string.
#Fortran
Fortran
CHARACTER(10) :: intstr = "12345", realstr = "1234.5" INTEGER :: i REAL :: r   READ(intstr, "(I10)") i ! Read numeric string into integer i i = i + 1 ! increment i WRITE(intstr, "(I10)") i ! Write i back to string   READ(realstr, "(F10.1)") r r = r + 1.0 WRITE(realstr, "(F10.1)")...
http://rosettacode.org/wiki/Integer_comparison
Integer comparison
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Eiffel
Eiffel
class APPLICATION inherit ARGUMENTS create make   feature {NONE} -- Initialization   make local i, j: INTEGER_32 do io.read_integer_32 i := io.last_integer_32   io.read_integer_32 j := io.last_integer_32   if i < j then print("first is less than second%N") end if i = j then print...
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#Pascal
Pascal
#!/usr/bin/perl do "include.pl"; # Utilize source from another file sayhello();
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#Perl
Perl
#!/usr/bin/perl do "include.pl"; # Utilize source from another file sayhello();
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#Phix
Phix
include pGUI.e
http://rosettacode.org/wiki/IBAN
IBAN
This page uses content from Wikipedia. The original article was at IBAN. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) The   International Bank Account Number (IBAN)   is an internationally agree...
#Fortran
Fortran
  program ibancheck   use ISO_FORTRAN_ENV   implicit none   character(4), dimension(75) :: cc = (/ & "AD24","AE23","AL28","AT20","AZ28","BA20","BE16","BG22","BH22","BR29", & "BY28","CH21","CR22","CY28","CZ24","DE22","DK18","DO28","EE20","ES24", & "FI18","FO18","FR27","GB22",...
http://rosettacode.org/wiki/Humble_numbers
Humble numbers
Humble numbers are positive integers which have   no   prime factors   >   7. Humble numbers are also called   7-smooth numbers,   and sometimes called   highly composite, although this conflicts with another meaning of   highly composite numbers. Another way to express the above is: humble = 2i × 3j × 5k...
#Phix
Phix
-- demo/rosetta/humble.exw with javascript_semantics include mpfr.e procedure humble(integer n, bool countdigits=false) -- if countdigits is false: show first n humble numbers, -- if countdigits is true: count them up to n digits. sequence humble = {mpz_init(1)}, nexts = {2,3,5,7}, indi...
http://rosettacode.org/wiki/Identity_matrix
Identity matrix
Task Build an   identity matrix   of a size known at run-time. An identity matrix is a square matrix of size n × n, where the diagonal elements are all 1s (ones), and all the other elements are all 0s (zeroes). I n = [ 1 0 0 ⋯ 0 0 1 0 ⋯ 0 0 0 1 ⋯ 0 ⋮ ⋮ ⋮ ⋱ ...
#Component_Pascal
Component Pascal
  MODULE Algebras; IMPORT StdLog,Strings;   TYPE Matrix = POINTER TO ARRAY OF ARRAY OF INTEGER;   PROCEDURE NewIdentityMatrix(n: INTEGER): Matrix; VAR m: Matrix; i: INTEGER; BEGIN NEW(m,n,n); FOR i := 0 TO n - 1 DO m[i,i] := 1; END; RETURN m; END NewIdentityMatrix;   PROCEDURE Show(m: Matrix); VAR i,j: INTEGE...
http://rosettacode.org/wiki/Image_noise
Image noise
Generate a random black and white   320x240   image continuously, showing FPS (frames per second). A sample image
#Tcl
Tcl
package require Tk   proc generate {img width height} { set data {} for {set i 0} {$i<$height} {incr i} { set line {} for {set j 0} {$j<$width} {incr j} { lappend line [lindex "#000000 #FFFFFF" [expr {rand() < 0.5}]] } lappend data $line } $img put $data }   set time 0.0 set count 0   proc loop...
http://rosettacode.org/wiki/Integer_sequence
Integer sequence
Task Create a program that, when run, would display all integers from   1   to   ∞   (or any relevant implementation limit),   in sequence   (i.e.   1, 2, 3, 4, etc)   if given enough time. An example may not be able to reach arbitrarily-large numbers based on implementations limits.   For example, if integer...
#Maple
Maple
for n do print(n) end do;
http://rosettacode.org/wiki/Integer_sequence
Integer sequence
Task Create a program that, when run, would display all integers from   1   to   ∞   (or any relevant implementation limit),   in sequence   (i.e.   1, 2, 3, 4, etc)   if given enough time. An example may not be able to reach arbitrarily-large numbers based on implementations limits.   For example, if integer...
#Mathematica_.2F_Wolfram_Language
Mathematica / Wolfram Language
  x = 1; Monitor[While[True, x++], x]  
http://rosettacode.org/wiki/Integer_sequence
Integer sequence
Task Create a program that, when run, would display all integers from   1   to   ∞   (or any relevant implementation limit),   in sequence   (i.e.   1, 2, 3, 4, etc)   if given enough time. An example may not be able to reach arbitrarily-large numbers based on implementations limits.   For example, if integer...
#MATLAB_.2F_Octave
MATLAB / Octave
a = 1; while (1) printf('%i\n',a); a=a+1; end;
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#Ring
Ring
  fp = fopen("C:\Ring\ReadMe.txt","r")   r = fgetc(fp) while isstring(r) r = fgetc(fp) if r = char(10) see nl else see r ok end fclose(fp)    
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#Ruby
Ruby
stream = $stdin stream.each do |line| # process line end
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#Run_BASIC
Run BASIC
open "\testFile.txt" for input as #f while not(eof(#f)) line input #f, a$ print a$ wend close #f
http://rosettacode.org/wiki/Josephus_problem
Josephus problem
Josephus problem is a math puzzle with a grim description: n {\displaystyle n} prisoners are standing on a circle, sequentially numbered from 0 {\displaystyle 0} to n − 1 {\displaystyle n-1} . An executioner walks along the circle, starting from prisoner 0 {\displaystyle 0} , removing eve...
#TypeScript
TypeScript
function josephus(n: number, k: number): number { if (!n) { return 1; }   return ((josephus(n - 1, k) + k - 1) % n) + 1; }
http://rosettacode.org/wiki/I_before_E_except_after_C
I before E except after C
The phrase     "I before E, except after C"     is a widely known mnemonic which is supposed to help when spelling English words. Task Using the word list from   http://wiki.puzzlers.org/pub/wordlists/unixdict.txt, check if the two sub-clauses of the phrase are plausible individually:   "I before E when not pre...
#FreeBASIC
FreeBASIC
Function getfile(file As String) As String Dim As Integer F = Freefile Dim As String text,intext Open file For Input As #F Line Input #F,text While Not Eof(F) Line Input #F,intext text=text+Chr(10)+intext Wend close #F Return text End Function   Function TALLY(instring ...
http://rosettacode.org/wiki/Increment_a_numerical_string
Increment a numerical string
Task Increment a numerical string.
#FreeBASIC
FreeBASIC
' FB 1.05.0 Win64   Function Increment (num As String) As String Dim d As Double = Val(num) Return Str(d + 1.0) End Function   Dim num(5) As String = {"1", "5", "81", "123.45", "777.77", "1000"} For i As Integer = 0 To 5 Print num(i); " + 1", " = "; Increment(num(i)) Next   Print Print "Press any key to exit" Sle...
http://rosettacode.org/wiki/Integer_comparison
Integer comparison
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Elena
Elena
import extensions;   public program() { var a := console.readLine().toInt(); var b := console.readLine().toInt();   if (a < b) { console.printLine(a," is less than ",b) };   if (a == b) { console.printLine(a," equals ",b) };   if (a > b) { console.printLine(a," is greater than ",b) }...
http://rosettacode.org/wiki/Integer_comparison
Integer comparison
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Elixir
Elixir
{a,_} = IO.gets("Enter your first integer: ") |> Integer.parse {b,_} = IO.gets("Enter your second integer: ") |> Integer.parse   cond do a < b -> IO.puts "#{a} is less than #{b}" a > b -> IO.puts "#{a} is greater than #{b}" a == b -> IO.puts "#{a} is equal to #{b}" end
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#PHP
PHP
include("file.php")
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#Picat
Picat
cl("include_file.pi")
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#PicoLisp
PicoLisp
(load "file1.l" "file2.l" "file3.l")
http://rosettacode.org/wiki/IBAN
IBAN
This page uses content from Wikipedia. The original article was at IBAN. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) The   International Bank Account Number (IBAN)   is an internationally agree...
#FreeBASIC
FreeBASIC
' FB 1.05.0 Win64   ' List updated to release 72, 25 November 2016, of IBAN Registry (75 countries) Dim Shared countryCodes As String countryCodes = _ "AD24 AE23 AL28 AT20 AZ28 BA20 BE16 BG22 BH22 BR29 BY28 CH21 CR22 CY28 CZ24 DE22 " _ "DK18 DO28 EE20 ES24 FI18 FO18 FR27 GB22 GE22 GI23 GL18 GR27 GT28 HR21 HU28 ...
http://rosettacode.org/wiki/Humble_numbers
Humble numbers
Humble numbers are positive integers which have   no   prime factors   >   7. Humble numbers are also called   7-smooth numbers,   and sometimes called   highly composite, although this conflicts with another meaning of   highly composite numbers. Another way to express the above is: humble = 2i × 3j × 5k...
#PL.2FI
PL/I
100H: /* FIND SOME HUMBLE NUMBERS - NUMBERS WITH NO PRIME FACTORS ABOVE 7 */ BDOS: PROCEDURE( FN, ARG ); /* CP/M BDOS SYSTEM CALL */ DECLARE FN BYTE, ARG ADDRESS; GOTO 5; END BDOS; PRINT$CHAR: PROCEDURE( C ); DECLARE C BYTE; CALL BDOS( 2, C ); END; PRINT$STRING: PROCEDURE( S ); DECLARE S AD...
http://rosettacode.org/wiki/Identity_matrix
Identity matrix
Task Build an   identity matrix   of a size known at run-time. An identity matrix is a square matrix of size n × n, where the diagonal elements are all 1s (ones), and all the other elements are all 0s (zeroes). I n = [ 1 0 0 ⋯ 0 0 1 0 ⋯ 0 0 0 1 ⋯ 0 ⋮ ⋮ ⋮ ⋱ ...
#D
D
import std.traits;   T[][] matId(T)(in size_t n) pure nothrow if (isAssignable!(T, T)) { auto Id = new T[][](n, n);   foreach (r, row; Id) { static if (__traits(compiles, {row[] = 0;})) { row[] = 0; // vector op doesn't work with T = BigInt row[r] = 1; } else { ...
http://rosettacode.org/wiki/Image_noise
Image noise
Generate a random black and white   320x240   image continuously, showing FPS (frames per second). A sample image
#Visual_Basic_.NET
Visual Basic .NET
Imports System.Drawing.Imaging   Public Class frmSnowExercise Dim bRunning As Boolean = True   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load   ' Tell windows we want to handle all the painting and that we want it ...
http://rosettacode.org/wiki/Integer_sequence
Integer sequence
Task Create a program that, when run, would display all integers from   1   to   ∞   (or any relevant implementation limit),   in sequence   (i.e.   1, 2, 3, 4, etc)   if given enough time. An example may not be able to reach arbitrarily-large numbers based on implementations limits.   For example, if integer...
#Maxima
Maxima
for i do disp(i);
http://rosettacode.org/wiki/Integer_sequence
Integer sequence
Task Create a program that, when run, would display all integers from   1   to   ∞   (or any relevant implementation limit),   in sequence   (i.e.   1, 2, 3, 4, etc)   if given enough time. An example may not be able to reach arbitrarily-large numbers based on implementations limits.   For example, if integer...
#min
min
0 (dup) () (puts succ) () linrec
http://rosettacode.org/wiki/Integer_sequence
Integer sequence
Task Create a program that, when run, would display all integers from   1   to   ∞   (or any relevant implementation limit),   in sequence   (i.e.   1, 2, 3, 4, etc)   if given enough time. An example may not be able to reach arbitrarily-large numbers based on implementations limits.   For example, if integer...
#.D0.9C.D0.9A-61.2F52
МК-61/52
1 П4 ИП4 С/П КИП4 БП 02
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#Rust
Rust
use std::io::{self, BufReader, Read, BufRead}; use std::fs::File;   fn main() { print_by_line(io::stdin()) .expect("Could not read from stdin");   File::open("/etc/fstab") .and_then(print_by_line) .expect("Could not read from file"); }   fn print_by_line<T: Read>(reader: T) -> io::Resul...
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#Scala
Scala
scala.io.Source.fromFile("input.txt").getLines().foreach { line => ... }
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#sed
sed
$ seq 5 | sed '' 1 2 3 4 5
http://rosettacode.org/wiki/Josephus_problem
Josephus problem
Josephus problem is a math puzzle with a grim description: n {\displaystyle n} prisoners are standing on a circle, sequentially numbered from 0 {\displaystyle 0} to n − 1 {\displaystyle n-1} . An executioner walks along the circle, starting from prisoner 0 {\displaystyle 0} , removing eve...
#Tcl
Tcl
proc josephus {number step {survivors 1}} { for {set i 0} {$i<$number} {incr i} {lappend l $i} for {set i 1} {[llength $l]} {incr i} { # If the element is to be killed, append to the kill sequence if {$i%$step == 0} { lappend killseq [lindex $l 0] set l [lrange $l 1 end] } else { # Roll the li...
http://rosettacode.org/wiki/I_before_E_except_after_C
I before E except after C
The phrase     "I before E, except after C"     is a widely known mnemonic which is supposed to help when spelling English words. Task Using the word list from   http://wiki.puzzlers.org/pub/wordlists/unixdict.txt, check if the two sub-clauses of the phrase are plausible individually:   "I before E when not pre...
#FutureBasic
FutureBasic
include "NSLog.incl"   #plist NSAppTransportSecurity @{NSAllowsArbitraryLoads:YES}   void local fn CheckWord( wrd as CFStringRef, txt as CFStringRef, c as ^long, x as ^long ) CFRange range = fn StringRangeOfString( wrd, txt ) while ( range.location != NSNotFound ) if ( range.location > 0 ) select ( fn Str...
http://rosettacode.org/wiki/Increment_a_numerical_string
Increment a numerical string
Task Increment a numerical string.
#Frink
Frink
  a = input["Enter number: "] toString[eval[a] + 1]  
http://rosettacode.org/wiki/Increment_a_numerical_string
Increment a numerical string
Task Increment a numerical string.
#FutureBasic
FutureBasic
  include "NSLog.incl"   CFStringRef s = @"12345" NSInteger i   for i = 1 to 10 NSLog( @"%ld", fn StringIntegerValue( s ) + i ) next HandleEvents  
http://rosettacode.org/wiki/Integer_comparison
Integer comparison
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Emacs_Lisp
Emacs Lisp
(defun integer-comparison (a b) "Compare A to B and print the outcome in the message buffer." (interactive "nFirst integer ⇒\nnSecond integer ⇒") (cond ((< a b) (message "%d is less than %d." a b)) ((> a b) (message "%d is greater than %d." a b)) ((= a b) (message "%d is equal to %d." a b))))
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#Pike
Pike
#include "foo.txt"
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#PL.2FI
PL/I
%include myfile;
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#PL.2FM
PL/M
$INCLUDE (fileName.inc)
http://rosettacode.org/wiki/IBAN
IBAN
This page uses content from Wikipedia. The original article was at IBAN. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) The   International Bank Account Number (IBAN)   is an internationally agree...
#Free_Pascal
Free Pascal
{$mode objFPC}   uses // for delSpace function strUtils, // GNU multiple-precision library GMP;   var /// this trie contains the correct IBAN length depending on the country code IBANLengthInCountry: array['A'..'Z', 'A'..'Z'] of integer;   type /// Human-readable representation of an IBAN without spaces IBANRep...
http://rosettacode.org/wiki/Humble_numbers
Humble numbers
Humble numbers are positive integers which have   no   prime factors   >   7. Humble numbers are also called   7-smooth numbers,   and sometimes called   highly composite, although this conflicts with another meaning of   highly composite numbers. Another way to express the above is: humble = 2i × 3j × 5k...
#PL.2FM
PL/M
100H: /* FIND SOME HUMBLE NUMBERS - NUMBERS WITH NO PRIME FACTORS ABOVE 7 */ BDOS: PROCEDURE( FN, ARG ); /* CP/M BDOS SYSTEM CALL */ DECLARE FN BYTE, ARG ADDRESS; GOTO 5; END BDOS; PRINT$CHAR: PROCEDURE( C ); DECLARE C BYTE; CALL BDOS( 2, C ); END; PRINT$STRING: PROCEDURE( S ); DECLARE S AD...
http://rosettacode.org/wiki/Identity_matrix
Identity matrix
Task Build an   identity matrix   of a size known at run-time. An identity matrix is a square matrix of size n × n, where the diagonal elements are all 1s (ones), and all the other elements are all 0s (zeroes). I n = [ 1 0 0 ⋯ 0 0 1 0 ⋯ 0 0 0 1 ⋯ 0 ⋮ ⋮ ⋮ ⋱ ...
#Delphi
Delphi
program IdentityMatrix;   // Modified from the Pascal version   {$APPTYPE CONSOLE}   var matrix: array of array of integer; n, i, j: integer;   begin write('Size of matrix: '); readln(n); setlength(matrix, n, n);   for i := 0 to n - 1 do matrix[i,i] := 1;   for i := 0 to n - 1 do begin for j := ...
http://rosettacode.org/wiki/Image_noise
Image noise
Generate a random black and white   320x240   image continuously, showing FPS (frames per second). A sample image
#Wren
Wren
import "dome" for Window import "graphics" for Canvas, Color import "random" for Random   class Game { static init() { Window.title = "Image Noise" __w = 320 __h = 240 Window.resize(__w, __h) Canvas.resize(__w, __h) __r = Random.new() __t = System.clock } ...
http://rosettacode.org/wiki/Integer_sequence
Integer sequence
Task Create a program that, when run, would display all integers from   1   to   ∞   (or any relevant implementation limit),   in sequence   (i.e.   1, 2, 3, 4, etc)   if given enough time. An example may not be able to reach arbitrarily-large numbers based on implementations limits.   For example, if integer...
#ML.2FI
ML/I
MCSKIP "WITH" NL "" Integer sequence "" Will overflow when it reaches implementation-defined signed integer limit MCSKIP MT,<> MCINS %. MCDEF DEMO WITHS NL AS <MCSET T1=1 %L1.%T1. MCSET T1=T1+1 MCGO L1 > DEMO
http://rosettacode.org/wiki/Integer_sequence
Integer sequence
Task Create a program that, when run, would display all integers from   1   to   ∞   (or any relevant implementation limit),   in sequence   (i.e.   1, 2, 3, 4, etc)   if given enough time. An example may not be able to reach arbitrarily-large numbers based on implementations limits.   For example, if integer...
#Modula-2
Modula-2
MODULE Sequence; FROM FormatString IMPORT FormatString; FROM Terminal IMPORT WriteString,ReadChar;   VAR buf : ARRAY[0..63] OF CHAR; i : CARDINAL; BEGIN i := 1; WHILE i>0 DO FormatString("%c ", buf, i); WriteString(buf); INC(i) END; ReadChar END Sequence.
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#Seed7
Seed7
$ include "seed7_05.s7i";   const proc: main is func local var string: line is ""; begin while hasNext(IN) do readln(line); writeln("LINE: " <& line); end while; end func;
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#Sidef
Sidef
var file = File(__FILE__) file.open_r(\var fh, \var err) || die "#{file}: #{err}"   fh.each { |line| # iterates the lines of the fh line.each_word { |word| # iterates the words of the line say word } }
http://rosettacode.org/wiki/Input_loop
Input loop
Input loop is part of Short Circuit's Console Program Basics selection. Task Read from a text stream either word-by-word or line-by-line until the stream runs out of data. The stream will have an unknown amount of data on it.
#Slate
Slate
(File newNamed: 'README') reader sessionDo: [| :input | input lines do: [| :line | inform: line]].
http://rosettacode.org/wiki/Josephus_problem
Josephus problem
Josephus problem is a math puzzle with a grim description: n {\displaystyle n} prisoners are standing on a circle, sequentially numbered from 0 {\displaystyle 0} to n − 1 {\displaystyle n-1} . An executioner walks along the circle, starting from prisoner 0 {\displaystyle 0} , removing eve...
#VBScript
VBScript
  Function josephus(n,k,s) Set prisoner = CreateObject("System.Collections.ArrayList") For i = 0 To n - 1 prisoner.Add(i) Next index = -1 Do Until prisoner.Count = s step_count = 0 Do Until step_count = k If index+1 <= prisoner.Count-1 Then index = index+1 Else index = (index+1)-(prisoner.Count...
http://rosettacode.org/wiki/I_before_E_except_after_C
I before E except after C
The phrase     "I before E, except after C"     is a widely known mnemonic which is supposed to help when spelling English words. Task Using the word list from   http://wiki.puzzlers.org/pub/wordlists/unixdict.txt, check if the two sub-clauses of the phrase are plausible individually:   "I before E when not pre...
#Go
Go
package main   import ( "bufio" "fmt" "log" "os" "regexp" "strings" )   func main() { f, err := os.Open("unixdict.txt") if err != nil { log.Fatalln(err) } defer f.Close()   s := bufio.NewScanner(f) rie := regexp.MustCompile("^ie|[^c]ie") rei := regexp.MustCompile("^ei|[^c]ei") var cie, ie int var cei, ...
http://rosettacode.org/wiki/Increment_a_numerical_string
Increment a numerical string
Task Increment a numerical string.
#F.C5.8Drmul.C3.A6
Fōrmulæ
Public Sub Main() Dim vInput As Variant = "12345"   Inc vInput Print vInput   End
http://rosettacode.org/wiki/Increment_a_numerical_string
Increment a numerical string
Task Increment a numerical string.
#Gambas
Gambas
Public Sub Main() Dim vInput As Variant = "12345"   Inc vInput Print vInput   End
http://rosettacode.org/wiki/Integer_comparison
Integer comparison
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Erlang
Erlang
  main() -> {ok, [N]} = io:fread("First integer: ", "~d"), {ok, [M]} = io:fread("First integer: ", "~d"), if N < M -> io:format("~b is less than ~b~n",[N,M]); N > M -> io:format("~b is greater than ~b~n",[N,M]); N == M -> io:format("~b is equal to ...
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#PowerBASIC
PowerBASIC
#INCLUDE "Win32API.inc" #INCLUDE ONCE "Win32API.inc"
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#PowerShell
PowerShell
  <# A module is a set of related Windows PowerShell functionalities, grouped together as a convenient unit (usually saved in a single directory). By defining a set of related script files, assemblies, and related resources as a module, you can reference, load, persist, and share your code much easier than ...
http://rosettacode.org/wiki/Include_a_file
Include a file
Task Demonstrate the language's ability to include source code from other files. See Also Compiler/Simple file inclusion pre processor
#Processing
Processing
MySketch/ MySketch.pde one.pde two.pde MyClass.java
http://rosettacode.org/wiki/IBAN
IBAN
This page uses content from Wikipedia. The original article was at IBAN. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) The   International Bank Account Number (IBAN)   is an internationally agree...
#Go
Go
package main   import ( "regexp" "strings" "testing" )   var lengthByCountryCode = map[string]int{ "AL": 28, "AD": 24, "AT": 20, "AZ": 28, "BE": 16, "BH": 22, "BA": 20, "BR": 29, "BG": 22, "CR": 21, "HR": 21, "CY": 28, "CZ": 24, "DK": 18, "DO": 28, "EE": 20, "FO": 18, "FI": 18, "FR": 27, "GE": 22, "DE": 22, "GI"...
http://rosettacode.org/wiki/Humble_numbers
Humble numbers
Humble numbers are positive integers which have   no   prime factors   >   7. Humble numbers are also called   7-smooth numbers,   and sometimes called   highly composite, although this conflicts with another meaning of   highly composite numbers. Another way to express the above is: humble = 2i × 3j × 5k...
#Polyglot:PL.2FI_and_PL.2FM
Polyglot:PL/I and PL/M
/* FIND SOME HUMBLE NUMBERS - NUMBERS WITH NO PRIME FACTORS ABOVE 7 */ humble_100H: procedure options (main);   /* PROGRAM-SPECIFIC %REPLACE STATEMENTS MUST APPEAR BEFORE THE %INCLUDE AS */ /* E.G. THE CP/M PL/I COMPILER DOESN'T LIKE THEM TO FOLLOW PROCEDURES */ ...
http://rosettacode.org/wiki/Identity_matrix
Identity matrix
Task Build an   identity matrix   of a size known at run-time. An identity matrix is a square matrix of size n × n, where the diagonal elements are all 1s (ones), and all the other elements are all 0s (zeroes). I n = [ 1 0 0 ⋯ 0 0 1 0 ⋯ 0 0 0 1 ⋯ 0 ⋮ ⋮ ⋮ ⋱ ...
#Eiffel
Eiffel
  class APPLICATION   inherit ARGUMENTS   create make   feature {NONE} -- Initialization   make -- Run application. local dim : INTEGER -- Dimension of the identity matrix do from dim := 1 until dim > 10 loop print_matrix( identity_matrix(dim) ) dim := dim + 1 io.new_line end   ...