June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -0,0 +1,26 @@
/* partially created by Aykayayciti Earl Lamont Montgomery
April 9th, 2018 */
/* global and local scrope
from the Falcon survival
guide book */
// global scope
sqr = 1.41
function square( x )
// local scope
sqr = x * x
return sqr
end
number = square( 8 ) * sqr
a = [1, 2, 3] // array
b = 1 // variable declaration
e = 1.0 // float
f = "string" // string
/* There are plenty more
data types in Falcon */

View file

@ -0,0 +1,33 @@
! Strings and arrays must be declared.
! Everything else is 8-byte float, READ/WRITE converts
CHARACTER str="abcdef", str2*345, str3*1E6/"xyz"/
REAL, PARAMETER :: named_constant = 3.1415
REAL :: n=2, cols=4, vec(cols), mtx(n, cols)
DATA vec/2,3,4,5/, mtx/1,2,3.1415,4, 5,6,7,8/
named = ALIAS(alpha, beta, gamma) ! gamma == named(3)
ALIAS(vec,n, subvec,2) ! share subvec and vec(n...n+1)
ALIAS(str,3, substr,n) ! share substr and str(3:3+n-1)
a = EXP(b + c) ! assign/initialze a=1, b=0, c=0
str = "blahblah" ! truncate/expand if needed
beta = "blahblah" ! illegal
CALL noArguments_noUSE ! global scope SUBROUTINE
CALL Arguments_or_USE(a) ! local scope SUBROUTINE
t = func() ! local scope FUNCTION
SUBROUTINE noArguments_noUSE() ! all global
vec2 = $ ! 1,2,3,...
END
SUBROUTINE Arguments_or_USE(var) ! all local
USE : vec ! use global object
var = SUM(vec)
t = TIME() ! local, static, USEd by func()
END
FUNCTION func() ! all local
USE Arguments_or_USE : t ! use local object
func = t
END

View file

@ -0,0 +1 @@
U8 i;

View file

@ -0,0 +1,2 @@
U8 b1 = 8;
U8 b2 = b1 * 10;

View file

@ -0,0 +1 @@
U8 uint1, uint2, uint3;

View file

@ -0,0 +1 @@
U8 *str = "The HolyC Language";

View file

@ -0,0 +1,13 @@
global gvar # a global
procedure main(arglist) # arglist is a parameter of main
local a,b,i,x # a, b, i, x are locals withing main
static y # a static (silly in main)
x := arglist[1]
a := 1.0
i := 10
b := [x,a,i,b]
# ... rest of program
end

View file

@ -1,6 +1,6 @@
say ++$; # this is an anonymous state variable
say ++$; # this is a different anonymous state variable, prefix:<++> forces it into numerical context and defaults it to 0
say $+=2 for 1..10 # here we do something useful with another anonymous variable
say $+=2 for 1..10; # here we do something useful with another anonymous variable
sub foo { $^a * $^b } # for positional arguments we often can't be bothered to declare them or to give them fancy names
say foo 3, 4;

View file

@ -0,0 +1,8 @@
# these examples, respectively, refer to integer, float, boolean, and string objects
example1 = 3
example2 = 3.0
example3 = True
example4 = "hello"
# example1 now refers to a string object.
example1 = "goodbye"

View file

@ -4,7 +4,7 @@ cc = 2*10 /*assigns chars 20 ───► CC
dd = 'Adam' /*assigns chars Adam ───► DD */
ee = "Adam" /*same as above ───► EE */
ff = 10. /*assigns chars 10. ───► FF */
gg='10.' /*same as above ───► GG */
gg = '10.' /*same as above ───► GG */
hh = "+10" /*assigns chars +10 ───► hh */
ii = 1e1 /*assigns chars 1e1 ───► ii */
jj = +.1e+2 /*assigns chars .1e+2 ───► jj */

View file

@ -0,0 +1,4 @@
Dim wholeNumber as Integer = 3
Dim realNumber as Double = 3.0
Dim isRaining as Boolean = False
Dim greeting as String = "Hello, this is World speaking."