Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1 @@
Foo_Error : exception;

View file

@ -0,0 +1,4 @@
procedure Foo is
begin
raise Foo_Error;
end Foo;

View file

@ -0,0 +1,6 @@
...
exception
when Foo_Error =>
if ... then -- Alas, cannot handle it here,
raise; -- continue propagation of
end if;

View file

@ -0,0 +1,9 @@
procedure Call_Foo is
begin
Foo;
exception
when Foo_Error =>
... -- do something
when others =>
... -- this catches all other exceptions
end Call_Foo;

View file

@ -0,0 +1,12 @@
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
begin
...
Raise_Exception (Foo_Error'Identity, "This is the exception message");
..
exception
when Error : others =>
Put_Line ("Something is wrong here" & Exception_Information (Error));
end Main;

View file

@ -1,3 +1,3 @@
val safediv = fn(x, y) { x / y ; catch : 0 }
val safediv = fn(x number, y number) { x / y ; catch : 0 }
safediv(7, 7) # 1
safediv(7, 0) # 0

View file

@ -0,0 +1,22 @@
local function get_day_no(day)
-- Throws an error if day is invalid.
return switch day:lower() do
case "monday" -> 1
case "tuesday" -> 2
case "wednesday" -> 3
case "thursday" -> 4
case "friday" -> 5
case "saturday" -> 6
case "sunday" -> 7
default -> error($"'{day}' is not a valid day in English.")
end
end
for {"thursday", "jeudi"} as day do
local ok, res = pcall(get_day_no, day)
if ok then
print($"'{day}' is day number {res}")
else
print(res)
end
end

View file

@ -0,0 +1 @@
throw "Any error message."

View file

@ -0,0 +1 @@
throw [System.IO.FileNotFoundException] ".\temp.txt not found."

View file

@ -0,0 +1,12 @@
try
{
Get-Content -Path .\temp.txt
}
catch [System.IO.FileNotFoundException]
{
Write-Host "File not found exception"
}
catch [System.Exception]
{
Write-Host "Other exception"
}

View file

@ -0,0 +1 @@
$Error[0] | Get-Member

View file

@ -1,4 +1,4 @@
-- 12 Sep 2025
-- 25 Apr 2026
include Setting
say 'EXCEPTIONS'
@ -9,4 +9,5 @@ say 'Square root of 0 is' SqRt(0)
say 'Square root of -1 is' SqRt(-1)
exit
-- Abend; Sqrt
include Math

View file

@ -0,0 +1,4 @@
str: "abc"
num: 5
try { 123 + str } |is-error .either { "error" } { print str }
try { 123 + num } |is-error .either { "error" } { print num }

View file

@ -0,0 +1,2 @@
⍣(⋕|0) "123" # parses okay
⍣(⋕|0) "notanumber" # supplies 0 on error