Polski
huginn - programming language with no quirks, so simple every child can master it.
Fork me on GitHub
git clone https://codestation.org/repo/huginn.git
git clone https://github.com/AmokHuginnsson/huginn.git
git clone https://bitbucket.org/huginn/huginn.git
  1. Syntax
  2. Keywords
  3. Types

    Huginn provides several built-in scalar and collection types, as well as user defined compound types.

    integer real string number character boolean list deque dict order lookup set
  4. Built-ins
  5. Core library classes
  6. Packages

switch, case and default statements:

Editor (vim) - switch.hgn (Try it online!) [+line no]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
#! /bin/sh
exec huginn --no-argv -E "${0}" "${@}"
#! huginn

main() {
	print( "Select number to describe: " );
	rawSel = input().strip();
	sel = integer( rawSel );
	print( "You selected `{}' to describe.\n".format( rawSel ) );
	switch ( sel ) {
		case ( 0 ): {
			print(
				"`Zero' is an identity element\n"
				"in Real numbers set with '+' operation.\n"
			);
		} break;
		case ( 1 ): {
			print(
				"`One' is identity element\n"
				"in Real numbers set with '*' operation.\n"
			);
		} break;
		case ( 2 ): {} /* fall through */
		case ( 3 ): {} /* fall through */
		case ( 4 ): {
			print( "`{}' is less than 5.\n".format( rawSel ) );
		} break;
		case ( 7 ): {
			print( "`Seven' is considered lucky number by some.\n" );
		} break;
		default: {
			print( "I do not know anything about your number.\n" );
		}
	}
	return ( 0 );
}

Program output:

Terminal - shell session [–line no]
[amok@vegeta](2/1)~/$ echo 0 | ./switch.hgn
Select number to describe: You selected `0' to describe.
`Zero' is an identity element
in Real numbers set with '+' operation.
[amok@vegeta](2/1)~/$ echo 1 | ./switch.hgn
Select number to describe: You selected `1' to describe.
`One' is an identity element
in Real numbers set with '*' operation.
[amok@vegeta](2/1)~/$ echo 2 | ./switch.hgn
Select number to describe: You selected `2' to describe.
`2' is less than 5.
[amok@vegeta](2/1)~/$ echo 3 | ./switch.hgn
Select number to describe: You selected `3' to describe.
`3' is less than 5.
[amok@vegeta](2/1)~/$ echo 4 | ./switch.hgn
Select number to describe: You selected `4' to describe.
`4' is less than 5.
[amok@vegeta](2/1)~/$ echo 5 | ./switch.hgn
Select number to describe: You selected `5' to describe.
I do not know anything about your number.
[amok@vegeta](2/1)~/$ echo 6 | ./switch.hgn
Select number to describe: You selected `6' to describe.
I do not know anything about your number.
[amok@vegeta](2/1)~/$ echo 7 | ./switch.hgn
Select number to describe: You selected `7' to describe.
`Seven' is considered lucky number by some.
[amok@vegeta](2/1)~/$ echo 8 | ./switch.hgn
Select number to describe: You selected `8' to describe.
I do not know anything about your number.
[amok@vegeta](2/1)~/$ echo 9 | ./switch.hgn
Select number to describe: You selected `9' to describe.
I do not know anything about your number.
[amok@vegeta](2/1)~/$