Janic Data Type Declarations

See Also: Declarations

Janic has both un-typed (similar to JavaScript) and typed (similar to Assembler) data types.  Janic has the following data types:

  • Integer (-infinity to +infinity)
  • Counting Number (1 to +infinity)
  • Whole Number (0 to +infinity)
  • Real Number
  • Fractions A = 1 foot // 3.0 seconds ;  B = 0.3333... feet per second;
  • Rational Numbers  A = 1 // 3;
  • Irrational Numbers A = PI;
  • Complex Real Number  A = 10.25i;
  • Prime Numbers; A = prime[0]; A = 2;
  • Date A = #Jan 3, 2020 Gregorian#; C = #105 AD Julian#;
  • Time B = #1:20 am CST#;
  • Datetime C = #Jan 3, 2020 1:20am CST#;
  • Text
  • Word
  • Character
  • Binary Record
  • Object
  • Matrix
  • Array
  • Table
  • Structure
  • Language Syntax
  • Cg2
  • Cg3

Declaring a Data type

%I = type{Integer};
%N = type{Whole Number};
%C = type{Counting Number};
 

A = 10;   or   A.%I = 10  or   A.%Integer = 10;
A.%I(5 bits) = 10;
B.%N(1 byte) = 255;
C.%C(1 byte) = 256;
D.%N(60 bits) = {};  D[0] = 18.3 gig;


Integers, Counting Numbers, Whole Numbers:

Declare A as a 53 bit Integer  A.%integer = 10;

Declare A as a 4 bit Integer: A.%integer(4 bits) = 10;

Declare A as a 512 bit Integer: A.%integer(512 bits) = 10;

There is no limit on the number of bits that represent a value

Declare an Array:

A.%Integer(10 bits) = {};
A.%allocation = allocation{initial size = 100 entries,
                           increment = 100 entries,
                           maximum = 1 gig entries};


or

A = declare:{type{Integer (10 bits), Array:{ allocation{initial size=100,increment=100, maximum=1 gig} } }