September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
45
Task/Special-variables/ALGOL-W/special-variables.alg
Normal file
45
Task/Special-variables/ALGOL-W/special-variables.alg
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
% the Algol W standard environment includes the following standard variables: %
|
||||
|
||||
integer I_W % field width for integer output %
|
||||
integer R_W % field width for real output %
|
||||
integer R_D % number of decimal places for real output %
|
||||
string(1) R_FORMAT % format for real output:
|
||||
S - "scaled" normalised mantissa with exponent
|
||||
A - "aligned" fixed point format
|
||||
F - "free" either scaled or aligned as appropriate
|
||||
for the value and field width
|
||||
%
|
||||
integer S_W % separator width - number of spaces following non-string output items %
|
||||
integer MAXINTEGER % largest integer value %
|
||||
real EPSILON % largest positive real number such that 1 + epsilon = 1 %
|
||||
long real LONGEPSILON % largest positive long real number such that 1 + longepsilon = 1 %
|
||||
long real MAXREAL % largest real number %
|
||||
long real PI % approximation to pi %
|
||||
|
||||
% the following reference(EXCEPTION) variables control how errors are handled:
|
||||
ENDFILE - end-of-file
|
||||
OVFL - overflow
|
||||
UNFL - underflow
|
||||
DIVZERO - division by zero
|
||||
INTOVFL - integer overflow
|
||||
INTDIVZERO - integer division by zero or modulo 0
|
||||
SQRTERR - invalid SQRT parameter
|
||||
EXPERR - invalid EXP parameter
|
||||
LNLOGERR - invalid LN or LOG parameter
|
||||
SINCOSERR - invalid SIN or COS parameter
|
||||
|
||||
The EXCEPTION record is defined as follows:
|
||||
|
||||
record EXCEPTION( logical XCPNOTED - true if the exception has occurred
|
||||
; integer XCPLIMIT - number of times the exception can occur
|
||||
before the program terminates
|
||||
, XCPACTION - if the program continues, controls how to
|
||||
replace the erroneous value
|
||||
; logical XCPMARK - true if an error message should be printed
|
||||
even if the program continues
|
||||
; string(64) XCPMSG - message to describe the exception
|
||||
)
|
||||
|
||||
if the relevant EXCEPTION variable is null, the exception is ignored,
|
||||
otherwise it is processed according to the settings of XCPLIMIT etc.
|
||||
%
|
||||
|
|
@ -1 +0,0 @@
|
|||
int main(int argc, char **argv){...}
|
||||
4
Task/Special-variables/Fortran/special-variables.f
Normal file
4
Task/Special-variables/Fortran/special-variables.f
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
INQUIRE(FILE = FILENAME(1:L),EXIST = EXIST, !Here we go. Does the file exist?
|
||||
1 ERR = 666,IOSTAT = IOSTAT) !Hopefully, named in good style, etc.
|
||||
IF (EXIST) THEN !So, does the named file already exist?
|
||||
...etc.
|
||||
24
Task/Special-variables/Kotlin/special-variables.kotlin
Normal file
24
Task/Special-variables/Kotlin/special-variables.kotlin
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// version 1.0.6
|
||||
|
||||
class President(val name: String) {
|
||||
var age: Int = 0
|
||||
set(value) {
|
||||
if (value in 0..125) field = value // assigning to backing field here
|
||||
else throw IllegalArgumentException("$name's age must be between 0 and 125")
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val pres = President("Donald")
|
||||
pres.age = 69
|
||||
val pres2 = President("Jimmy")
|
||||
pres2.age = 91
|
||||
val presidents = mutableListOf(pres, pres2)
|
||||
presidents.forEach {
|
||||
it.age++ // 'it' is implicit sole parameter of lambda expression
|
||||
println("President ${it.name}'s age is currently ${it.age}")
|
||||
}
|
||||
println()
|
||||
val pres3 = President("Theodore")
|
||||
pres3.age = 158
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
__DATE__, __DEBUG__, __FILE__, __LINE__, __NAME__, __TIME__
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
10 PRINT "The border colour is "; PEEK (23624): REM bordcr
|
||||
20 PRINT "The ramtop address is "; PEEK (23730) + 256 * PEEK (23731): REM ramtop
|
||||
30 POKE 23609,50: REM set keyboard pip to 50
|
||||
Loading…
Add table
Add a link
Reference in a new issue