Icon is associated with a high level computer programming language rising from the Snobol4 languages, CLU and C (K&R). It is an imperative and procedural language, whose syntax resembles the languages C and Pascal (language).
# Helloworld procedure hand () Write (" Hello World! ") end
Here a sample program Icon which reads in entry a file and posts on the standard exit the file with the numbered lines:
# This is a comment procedure hand (args) file: = &input file: = open (args) | stop (" Error of opening of fichier") numerote_ligne (file) end procedure numerote_ligne (file) count: = 0 while line: = read (file) C writes (account +: = 1, " " , line, " \ n") end
The generating make it possible, starting from an expression, to provide a succession of values. For example: every I: = (1 to 3) | (3 to 1 by -1) C… will allow us to vary I from 1 to 3 then from 3 to 1. Or yew (X | there) = (3 | 5) then… allows to test if one of the variables X or there with value 3 or 5
The mechanism of the evaluation directed by the goal makes it possible to launch a series of repetitive operations, without worrying about the case of stop. For example if we would wish to post all the values of a table , we would make: every Write (! )
ICON allows certain constructions, often more known functional languages, but nevertheless strong practices: Write (box I off { 0: " parfait" 1|- 1: " not loin" default: " far… " })
Here another example to show the power of the various existing operators in the case of the mixture of a table: every 1 to *tab C ? : =: ?
| Random links: | WAXQ | Chilung | Magnus Ier of Norway | Policy of Ethiopia | Surface S |