Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
5
Task/Null-object/Ada/null-object.adb
Normal file
5
Task/Null-object/Ada/null-object.adb
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
with Ada.Text_Io;
|
||||
|
||||
if Object = null then
|
||||
Ada.Text_Io.Put_line("object is null");
|
||||
end if;
|
||||
2
Task/Null-object/AutoIt/null-object.au3
Normal file
2
Task/Null-object/AutoIt/null-object.au3
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Local $object = Null
|
||||
If $object = Null Then MsgBox(0, "NULL", "Object is null")
|
||||
43
Task/Null-object/COBOL/null-object.cob
Normal file
43
Task/Null-object/COBOL/null-object.cob
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
identification division.
|
||||
program-id. null-objects.
|
||||
remarks. test with cobc -x -j null-objects.cob
|
||||
|
||||
data division.
|
||||
working-storage section.
|
||||
01 thing-not-thing usage pointer.
|
||||
|
||||
*> call a subprogram
|
||||
*> with one null pointer
|
||||
*> an omitted parameter
|
||||
*> and expect void return (callee returning omitted)
|
||||
*> and do not touch default return-code (returning nothing)
|
||||
procedure division.
|
||||
call "test-null" using thing-not-thing omitted returning nothing
|
||||
goback.
|
||||
end program null-objects.
|
||||
|
||||
*> Test for pointer to null (still a real thing that takes space)
|
||||
*> and an omitted parameter, (call frame has placeholder)
|
||||
*> and finally, return void, (omitted)
|
||||
identification division.
|
||||
program-id. test-null.
|
||||
|
||||
data division.
|
||||
linkage section.
|
||||
01 thing-one usage pointer.
|
||||
01 thing-two pic x.
|
||||
|
||||
procedure division using
|
||||
thing-one
|
||||
optional thing-two
|
||||
returning omitted.
|
||||
|
||||
if thing-one equal null then
|
||||
display "thing-one pointer to null" upon syserr
|
||||
end-if
|
||||
|
||||
if thing-two omitted then
|
||||
display "no thing-two was passed" upon syserr
|
||||
end-if
|
||||
goback.
|
||||
end program test-null.
|
||||
3
Task/Null-object/Chapel/null-object.chpl
Normal file
3
Task/Null-object/Chapel/null-object.chpl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
class C { };
|
||||
var c : owned C?; // is nil
|
||||
writeln(if c == nil then "nil" else "something");
|
||||
|
|
@ -6,8 +6,8 @@
|
|||
var a # defaults to null
|
||||
int b # defaults to 0
|
||||
void c # only one allowed value: null
|
||||
writeLine("nullable var equals to not nullable int: " + (a == b)) # allowed, false
|
||||
writeLine("nullable var equals to not nullable int: " + (a æ b)) # allowed, false
|
||||
^| if the data type of a is void we are sure that a is null |^
|
||||
writeLine("type of a equals to Void data type: " + (generic!a == void)) # true
|
||||
writeLine("integer value " + b + " equals to null: " + (b == null)) # allowed, always false
|
||||
writeLine("a void value equals to null: " + (c == null)) # always true
|
||||
writeLine("type of a equals to Void data type: " + (generic!a æ void)) # true
|
||||
writeLine("integer value " + b + " equals to null: " + (b æ null)) # allowed, always false
|
||||
writeLine("a void value equals to null: " + (c æ null)) # always true
|
||||
|
|
|
|||
3
Task/Null-object/PowerShell/null-object.ps1
Normal file
3
Task/Null-object/PowerShell/null-object.ps1
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
if ($null -eq $object) {
|
||||
...
|
||||
}
|
||||
3
Task/Null-object/Rebol/null-object-1.rebol
Normal file
3
Task/Null-object/Rebol/null-object-1.rebol
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
x: none
|
||||
|
||||
print ["x" either none? x ["is"]["isn't"] "none."]
|
||||
2
Task/Null-object/Rebol/null-object-2.rebol
Normal file
2
Task/Null-object/Rebol/null-object-2.rebol
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
unset? get/any 'some-var
|
||||
unset? get 'some-var
|
||||
Loading…
Add table
Add a link
Reference in a new issue