Data update

This commit is contained in:
Ingy dot Net 2024-04-19 16:56:29 -07:00
parent 0df55f9f24
commit aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions

View file

@ -1,6 +1,6 @@
every 1 to 10 by 2 # the simplest case that satisfies the task, step by 2
every 1 to 10 # no to, step is by 1 by default
every 1 to 10 # no by, step is 1 by default
every EXPR1 to EXPR2 by EXPR3 do EXPR4 # general case - EXPRn can be complete expressions including other generators such as to-by, every's do is optional
steps := [2,3,5,7] # a list
every i := 1 to 100 by !steps # . more complex, several passes with each step in the list steps, also we might want to know what value we are at

View file

@ -1 +1,17 @@
for x in countup(1, 10, 4): echo x
for n in 5 .. 9: # 5 to 9 (9-inclusive)
echo n
echo "" # spacer
for n in 5 ..< 9: # 5 to 9 (9-exclusive)
echo n
echo "" # spacer
for n in countup(0, 16, 4): # 0 to 16 step 4
echo n
echo "" # spacer
for n in countdown(16, 0, 4): # 16 to 0 step -4
echo n

View file

@ -4,7 +4,14 @@ const proc: main is func
local
var integer: number is 0;
begin
for number range 1 to 10 step 2 do
for number range 0 to 10 step 2 do # 10 is inclusive
writeln(number);
end for;
writeln; # spacer
for number range 10 downto 0 step 2 do
writeln(number);
end for;
end func;

View file

@ -0,0 +1,9 @@
const std = @import("std");
const stdout = @import("std").io.getStdOut().writer();
pub fn main() !void {
for (1..10) |n| {
if (n % 2 == 0) continue;
try stdout.print("{d}\n", .{n});
}
}