==== x0001_intro_231 | intro | tutorial.txt line 231 | expected: none
print "Hello, World"
print (0.1+0.2) - 0.3

delay
---- output
Hello, World
 0

==== x0004_intro_users_1357 | intro_users | tutorial.txt line 1357 | expected: none
print 1.2 - 1.0
print 'a';'b';'c'
print sprintf$('%s is %r %p old.', "Sally", 10, "year")

delay
---- output
 0.2 
abc
Sally is 10 years old.

==== x0005_intro_users_1369 | intro_users | tutorial.txt line 1369 | expected: none
print (0.1 + 0.2) - 0.3

0

delay
---- output
 0

==== x0006_assumptions_2006 | assumptions | tutorial.txt line 2006 | expected: none
 dim names$(20)
 dim string areas(100)

 delay
---- output


==== x0008_assumptions_2164 | assumptions | tutorial.txt line 2164 | expected: none
    mynumber = rnd(100)

    delay
---- output


==== x0009_program_structure_2367 | program_structure | tutorial.txt line 2367 | expected: none
a = 355 \ b = 113

delay
---- output


==== x0011_variable_names_and_data_type_2658 | variable_names_and_data_types | tutorial.txt line 2658 | expected: none
declare dynamic x

x = "hello"   // now x is a STRING
x = 3.14159   // now x is a REAL

delay
---- output


==== x0012_variable_names_and_data_type_2712 | variable_names_and_data_types | tutorial.txt line 2712 | expected: none
// Automatically created variables
full_name$ = "Sally Sue"
is_active? = true
total_cost = 19.95

// Explicitly declared variables
declare string shipping_address
declare real weight
declare boolean item_available

shipping_address = "123 Main St"
weight = 2.5
item_available? = true

delay
---- output


==== x0013_variable_names_and_data_type_2875 | variable_names_and_data_types | tutorial.txt line 2875 | expected: none
// A constant's value cannot be changed after definition.
const everything = 42

delay
---- output


==== x0020_variable_names_and_data_type_3035 | variable_names_and_data_types | tutorial.txt line 3035 | expected: none
declare freezable f
f = 10
freeze f
print typeof$(f)

delay
---- output
Name:F, Dtype:Real, *Freezable*, *Frozen*, *Narrow*

==== x0025_variable_names_and_data_type_3249 | variable_names_and_data_types | tutorial.txt line 3249 | expected: none
// Define a new type named 'money' based on REAL
type real money

// Declare a variable using the new type
declare money monthly_salary
monthly_salary = 5000.00

delay
---- output


==== x0028_variable_names_and_data_type_3284 | variable_names_and_data_types | tutorial.txt line 3284 | expected: none
// Create a secure string type for sensitive data
type nodump string secret

// Declare a variable using the secure type
declare secret password
password = "xxyyy"

delay
---- output


==== x0029_variable_names_and_data_type_3314 | variable_names_and_data_types | tutorial.txt line 3314 | expected: none
// This variable prints with a $, comma, and 2 decimal places.
declare format "$%.2m" price

price = 12300.456
print "Total price: "; price
// Output: Total price: $12,300.46

delay
---- output
Total price: $12,300.46

==== x0030_variable_names_and_data_type_3329 | variable_names_and_data_types | tutorial.txt line 3329 | expected: none
declare format "%.1f%%" success_rate
success_rate = 98.73
print "Success: "; success_rate
// Output: Success: 98.7%

delay
---- output
Success: 98.7%

==== x0033_variable_names_and_data_type_3387 | variable_names_and_data_types | tutorial.txt line 3387 | expected: none
declare real price
declare string input$

input$ = "12.95"
price = val(input$)

delay
---- output


==== x0034_variable_names_and_data_type_3401 | variable_names_and_data_types | tutorial.txt line 3401 | expected: none
declare string output$
declare real tax = 0.075

output$ = str$(tax)

delay
---- output


==== x0035_variable_names_and_data_type_3416 | variable_names_and_data_types | tutorial.txt line 3416 | expected: none
const sales_tax_rate = 0.08

declare string item_name$
declare real item_price, quantity

item_name$ = "Super Gadget"
item_price = 29.95
quantity = 2

subtotal = item_price * quantity
final_total = subtotal * (1 + sales_tax_rate)

print sprintf$("Item: %, Qty: %, Total: $%.2m", item_name$, quantity, final_total)

delay
---- output
Item: Super Gadget, Qty: 2, Total: $64.69

==== x0036_expressions_3571 | expressions | tutorial.txt line 3571 | expected: none
print 2 + 3

delay
---- output
 5

==== x0037_expressions_3588 | expressions | tutorial.txt line 3588 | expected: none
print "Good "; "morning"

delay
---- output
Good morning

==== x0041_expressions_3671 | expressions | tutorial.txt line 3671 | expected: none
print 10
print 10 + 5
print 10 - 5
print 10 * 5
print 10 / 5

delay
---- output
 10 
 15 
 5 
 50 
 2

==== x0042_expressions_3683 | expressions | tutorial.txt line 3683 | expected: none
base_price = 100
tax = 8.75

print base_price + tax

delay
---- output
 108.75

==== x0046_expressions_3779 | expressions | tutorial.txt line 3779 | expected: none
quantity = 12
price = 4.95

print quantity
print price
print quantity * price

delay
---- output
 12 
 4.95 
 59.4

==== x0083_operators_4769 | operators | tutorial.txt line 4769 | expected: none
apple_price = 0.50
banana_price = 0.30
num_apples = 4
num_bananas = 6

! Calculate the cost for each fruit
total_apple_cost = apple_price * num_apples
total_banana_cost = banana_price * num_bananas

! Calculate the subtotal
subtotal = total_apple_cost + total_banana_cost
print "Subtotal: $"; subtotal

! Add one more apple
num_apples++
print "Number of apples is now: "; num_apples

delay
---- output
Subtotal: $ 3.8 
Number of apples is now:  5

==== x0084_operators_4793 | operators | tutorial.txt line 4793 | expected: same
declare dynamic counter
counter = 5
counter++
print counter
counter = 'five'
when exception in
  counter++
use
  print extext$; ' -- '; _string$
end when

delay
---- output
 6 
Datatype mismatch -- COUNTER++: COUNTER holds a string -- ++ needs a number

==== x0085_operators_4814 | operators | tutorial.txt line 4814 | expected: same
cost = 120
budget = 150
under_by = -(cost - budget)
print "Under budget by: "; under_by

delay
---- output
Under budget by:  30

==== x0088_operators_4849 | operators | tutorial.txt line 4849 | expected: none
is_member? = true
purchase_total = 75.00

! Check if the customer gets a discount
is_eligible? = is_member? OR purchase_total > 100.00

print "Is eligible for discount? "; is_eligible?

delay
---- output
Is eligible for discount?  1

==== x0090_operators_4879 | operators | tutorial.txt line 4879 | expected: none
// Example bit flags
read_flag    = 1      // 0001
write_flag   = 2      // 0010
execute_flag = 4      // 0100

// Combine flags using OR
permissions = read_flag OR write_flag   // 0011

// Test if write flag is set
has_write? = (permissions AND write_flag) <> 0

// Toggle a flag using XOR
permissions = permissions XOR write_flag  // removes write_flag

print "Permissions: "; permissions
print "Has write? "; has_write?

delay
---- output
Permissions:  1 
Has write?  1

==== x0091_operators_5011 | operators | tutorial.txt line 5011 | expected: same
full_name$ = '  ada lovelace  '
clean$ = full_name$ 
  |> trim$() 
  |> ucase$()
print clean$

delay
---- output
ADA LOVELACE

==== x0092_operators_5028 | operators | tutorial.txt line 5028 | expected: none
print 'abcdef' 
  |> mid$(2, 3)
word_count = 'the quick brown fox' 
  |> elements(' ')
print word_count

delay
---- output
bcd
 4

==== x0094_operators_5050 | operators | tutorial.txt line 5050 | expected: none
  x$ = '  hi  '
  a$ = x$        // start with x$, which we will transform
    |> trim$()    // first trim it
    |> ucase$()  // next uppercase it
  print a$       // "HI"

  delay
---- output
HI

==== x0095_operators_5064 | operators | tutorial.txt line 5064 | expected: none
tax = 1000 
  |> calc_tax()                  ! amount = 1000, tax_rate defaults
print tax
tax = 1000 
  |> calc_tax(tax_rate = 0.25)
print tax

delay

routine calc_tax with amount, tax_rate = 0.1, returning tax
  tax = amount * tax_rate
end routine
---- output
 100 
 250

==== x0096_operators_5076 | operators | tutorial.txt line 5076 | expected: none
 100
 250

 delay
---- output


==== x0099_operators_5136 | operators | tutorial.txt line 5136 | expected: none
x = _nan
big = _inf
print x, big, -big                 !  NaN  Inf  -Inf
print big + 1, big - big, 1 / big  !  Inf  NaN  0
print x = x, x <> x                !  0  1      -- a NaN is not even equal to itself
print x < 1, x >= 1                !  0  0      -- every comparison with a NaN is false, except <>
print isnan(x), isinf(big)         !  1  1      -- the tests that do find them
print val("NaN"), str$(-_inf)      !  NaN  -Inf -- the texts round-trip
print div0inf(1, 0), div0inf(-1, 0), div0inf(0, 0)   !  Inf  -Inf  NaN -- asked for by name
print div0(1, 0), div0inf(6, 3)    !  0  2      -- div0 gives 0; a nonzero divisor is just division

delay
---- output
 NaN  Inf -Inf 
 Inf  NaN  0 
 0  1 
 0  0 
 1  1 
 NaN -Inf
 Inf -Inf  NaN 
 0  2

==== x0100_operators_5185 | operators | tutorial.txt line 5185 | expected: none
z = 3 + 4i
w = 1 - 2i
print z, w, 4i, -z                 !  3+4i  1-2i  0+4i  -3-4i
print z + w, z - w, z * w, z / w   !  4+2i  2+6i  11-2i  -1+2i
print 2 * z, z - 4i, (2 + 3i) ^ 2  !  6+8i  3+0i  -5+12i     -- promoted, never demoted; a whole-number power
print abs(z), real(z), imag(z), conj(z)   !  5  3  4  3-4i
print z = 3 + 4i, z = w, (3 + 0i) = 3     !  1  0  1  -- = and <> compare both parts
print typeof$(z)                   !  Name:Z, Dtype:Real, *Complex*
print (1 + 2i) / 3                 !  0.3333333333333333+0.6666666666666667i  -- 16 digits per part by default
print sprintf$("%.30r", (1 + 2i) / 3)     !  0.333333333333333333333333333333+0.666666666666666666666666666667i
print val("1e5+2.5e-3i"), complex(1.5, -2)   !  100000+0.0025i  1.5-2i  -- the text reads back
print round(arg(1i), 4), round(arg(-4), 4)   !  1.5708  3.1416

delay
---- output
 3+4i  1-2i  0+4i -3-4i 
 4+2i  2+6i  11-2i -1+2i 
 6+8i  3+0i -5+12i 
 5  3  4  3-4i 
 1  0  1 
Name:Z, Dtype:Real, *Complex*
 0.3333333333333333+0.6666666666666667i 
0.333333333333333333333333333333+0.666666666666666666666666666667i
 100000+0.0025i  1.5-2i 
 1.5708  3.1416

==== x0101_conditionals_5412 | conditionals | tutorial.txt line 5412 | expected: none
health = 9
if health < 10 then
  print "Health is critical! Use a potion!"
end if

delay
---- output
Health is critical! Use a potion!

==== x0102_conditionals_5428 | conditionals | tutorial.txt line 5428 | expected: none
health = 55
if health < 10 then
  print "Health is critical! Use a potion!"
else
  print "You are healthy enough to continue."
end if

delay
---- output
You are healthy enough to continue.

==== x0103_conditionals_5464 | conditionals | tutorial.txt line 5464 | expected: none
health = 45
if health < 10 then
  print "Health is critical! Use a potion!"
elseif health < 50 then
  print "Warning: Your health is getting low."
else
  print "You are in good shape."
end if

delay
---- output
Warning: Your health is getting low.

==== x0107_conditionals_5621 | conditionals | tutorial.txt line 5621 | expected: none
// Example 2: Range checking
a = 5
select case a
  case 1
    print "one"
  case 2 to 6
    print "range"
  case else
    print "else"
end select

b$ = "c"
select case b$
  case "a"
    print "a"
  case "b" to "e"
    print "range"
  case else
    print "else"
end select
// Output: range / range

delay
---- output
range
range

==== x0109_conditionals_5665 | conditionals | tutorial.txt line 5665 | expected: none
// Example 4: First match only (numeric)
x = 5
select case x
  case 1 to 10
    print "Matched range 1 to 10"
  case 5
    print "Matched exactly 5"
  case else
    print "No match"
end select
// Output: Matched range 1 to 10

// Example 5: First match only (string)
letter$ = "c"
select case letter$
  case "a" to "f"
    print "Matched range a to f"
  case "c"
    print "Matched exactly c"
  case else
    print "No match"
end select
// Output: Matched range a to f

delay
---- output
Matched range 1 to 10
Matched range a to f

==== x0110_conditionals_5708 | conditionals | tutorial.txt line 5708 | expected: none
number = 3

select case number
  case 1: print "One!"
  case 2: print "Two!"
  case 3: print "Three!"
  case else: print "Something else!"
end select

delay
---- output
Three!

==== x0112_conditionals_5779 | conditionals | tutorial.txt line 5779 | expected: none
x = 5
select case x
  case 1 to 10
    print "Matched range 1 to 10"
  case 5
    print "Matched exactly 5"
end select
// Output: Matched range 1 to 10

delay
---- output
Matched range 1 to 10

==== x0113_conditionals_5793 | conditionals | tutorial.txt line 5793 | expected: none
x = 5
select case x
  case 5
    print "Matched exactly 5"
  case 1 to 10
    print "Matched range 1 to 10"
end select
// Output: Matched exactly 5

delay
---- output
Matched exactly 5

==== x0114_conditionals_5826 | conditionals | tutorial.txt line 5826 | expected: none
len = 12
a = 5
b = 10

select case true
  case a > b
    print "greater"
  case len = 12
    print "len was 12"
end select

delay
---- output
len was 12

==== x0119_looping_6204 | looping | tutorial.txt line 6204 | expected: none
print "Starting countdown..."
for i = 10 to 1 step -1
  print i; "..."
  delay 1 ! Pause for 1 second
next i
print "Blast off!"

delay
---- output
Starting countdown...
 10 ...
 9 ...
 8 ...
 7 ...
 6 ...
 5 ...
 4 ...
 3 ...
 2 ...
 1 ...
Blast off!

==== x0120_looping_6220 | looping | tutorial.txt line 6220 | expected: none
dim chores$(3)
chores$(1) = "Take out trash"
chores$(2) = "DONE"
chores$(3) = "Feed the cat"

for i = 1 to size(chores$)
  ! Skip chores that are already marked as "DONE"
  if chores$(i) = "DONE" then iterate for
  
  print "Completing chore: "; chores$(i)
next i

delay
---- output
Completing chore: Take out trash
Completing chore: Feed the cat

==== x0121_looping_6242 | looping | tutorial.txt line 6242 | expected: same
dim readings(3)
fill readings with 12, -1, 30   ! -1 means the sensor was not ready
for sensor_no = 1 to 3
  if readings(sensor_no) < 0 then
    print "Sensor"; sensor_no; "not ready -- reading it again"
    readings(sensor_no) = 25    ! the second reading works
    repeat for
  end if
  print "Sensor"; sensor_no; "reads"; readings(sensor_no)
next sensor_no

delay
---- output
Sensor 1 reads 12 
Sensor 2 not ready -- reading it again
Sensor 2 reads 25 
Sensor 3 reads 30

==== x0122_looping_6277 | looping | tutorial.txt line 6277 | expected: same
dim amounts(5)
fill amounts with 40, -5, 25, 35, -10   ! a negative amount is a refund
total = 0
entry_no = 0
do
  entry_no++
  if amounts(entry_no) < 0 then iterate do   ! skip refunds
  total = total + amounts(entry_no)
  print "Added"; amounts(entry_no)
loop until entry_no = size(amounts)
print "Total:"; total

delay
---- output
Added 40 
Added 25 
Added 35 
Total: 100

==== x0123_looping_6340 | looping | tutorial.txt line 6340 | expected: same
const row_count = 3
const col_count = 4
dim grid(row_count, col_count)
for r = 1 to row_count
  for c = 1 to col_count
    grid(r, c) = r * 10 + c
  next c
next r
grid(2, 3) = -1          ! row 2 holds a negative value

total = 0
for r = 1 to row_count
  for c = 1 to col_count
    if grid(r, c) < 0 then iterate for r    ! skip the whole row
  next c
  for c = 1 to col_count
    total = total + grid(r, c)
  next c
next r
print 'Total of the clean rows:'; total

delay
---- output
Total of the clean rows: 180

==== x0124_looping_6372 | looping | tutorial.txt line 6372 | expected: same
cluster orders: customer$, amount
add cluster orders: customer$ = 'Crane', amount = 300
add cluster orders: customer$ = 'Acme', amount = 120
add cluster orders: customer$ = 'Bolt', amount = 75
dim blocked$(2)
fill blocked$ with 'bolt', 'Dyna'

collect cluster orders
  sort by orders->customer$
end collect
for each orders
  for k = 1 to size(blocked$)
    if same(orders->customer$, blocked$(k)) then iterate for orders
  next k
  print orders->customer$; orders->amount
next orders

delay
---- output
Acme 120 
Crane 300

==== x0125_looping_6410 | looping | tutorial.txt line 6410 | expected: same
dim answers$(*)
fill answers$ with 'Acme', 'maybe', 'y', 'Bolt', 'skip', 'Crane', 'n', ''
answer_no = 0

do named order
  answer_no++
  customer$ = answers$(answer_no)
  if customer$ = '' then exit do order
  do named confirm
    answer_no++
    answer$ = answers$(answer_no)
    select case lcase$(answer$)
    case 'skip'
      repeat do order              ! the next customer
    case 'y'
      print 'Shipped to '; customer$
    case 'n'
      print 'Held for '; customer$
    case else
      repeat do confirm            ! ask again
    end select
  end do confirm
loop order
print 'done'

delay
---- output
Shipped to Acme
Held for Crane
done

==== x0126_arrays_6702 | arrays | tutorial.txt line 6702 | expected: none
! Create an array with 5 slots for names
dim names$(5)

! Assign values to each slot using its index
names$(1) = "Alice"
names$(2) = "Bob"
names$(3) = "Charlie"

print "The second name is: "; names$(2)

delay
---- output
The second name is: Bob

==== x0127_arrays_6762 | arrays | tutorial.txt line 6762 | expected: none
dim names$(5)
names$(1) = "Alice"
names$(2) = "Bob"
names$(3) = "Charlie"

! We have our array of 5 names, with 3 filled
redim names$(10) ! Resize the array to have 10 slots

! The original data is still there
print "The second name is still: "; names$(2)

! Now we can add a new name in a new slot
names$(6) = "Frank"
print "The sixth name is: "; names$(6)

delay
---- output
The second name is still: Bob
The sixth name is: Frank

==== x0128_arrays_6793 | arrays | tutorial.txt line 6793 | expected: none
! Create an expandable array for a shopping list
dim shopping_list$(*)

delay
---- output


==== x0130_arrays_6833 | arrays | tutorial.txt line 6833 | expected: none
dim shopping_list$(*)
shopping_list$(*) = "Apples"
shopping_list$(*) = "Bread"
shopping_list$(*) = "Milk"

for i = 1 to size(shopping_list$)
  print i; ". "; shopping_list$(i)
next i

delay
---- output
 1 . Apples
 2 . Bread
 3 . Milk

==== x0131_arrays_6904 | arrays | tutorial.txt line 6904 | expected: none
dim scores(100)
fill scores with 0            ! all 100 elements are now 0

dim status$(50)
fill status$ with 'pending'   ! every element starts as 'pending'

dim nines(*)
fill nines with 100 of 9      ! an expandable array: a hundred 9s (see "Many of the same" below)
fill nines with 0             ! ...and later, zero everything it currently holds

delay
---- output


==== x0132_arrays_6932 | arrays | tutorial.txt line 6932 | expected: none
dim slot(12)
fill slot with seq(1, 12)            ! slot(1)=1, slot(2)=2, ... slot(12)=12

dim rate(11)
fill rate with seq(0, 1, 0.1)        ! 0, 0.1, 0.2, ... 1  -- EXACT decimals

dim countdown(10)
fill countdown with seq(10, 1, -1)

delay
---- output


==== x0135_arrays_7021 | arrays | tutorial.txt line 7021 | expected: none
dim buf(30)
fill buf with seq(1, 30)
fill buf(20) with 1, 2, 3, 4      ! elements 20..23; 19 and 24 untouched
fill buf(28) with 3 of 0          ! 28..30

dim x(*)
fill x with 10, 20, 30, 40, 50
fill x(3) with 9                  ! the same as x(3) = 9: size stays 5
fill x(9) with 8                  ! past the end: 6..8 become 0, size 9

delay
---- output


==== x0136_arrays_7052 | arrays | tutorial.txt line 7052 | expected: none
dim x(10)
fill x with 0
fill x(1 step 2) with 7           ! elements 1, 3, 5, 7, 9
fill x(2 step 2) with 1, 2, 3     ! 1, 2, 3 land at 2, 4, 6
fill x(1 step 3) with 4 of 9      ! 1, 4, 7, 10
fill x(10 step -4) with 5         ! 10, 6, 2: a negative step walks toward element 1

! the inner loop of an odd-only sieve: element k stands for 2k - 1, and
! the odd multiples of p from p * p on are every p-th element from (p * p + 1) / 2
dim flags?(50)
fill flags? with true
p = 3
fill flags?((p * p + 1) / 2 step p) with false

delay
---- output


==== x0138_arrays_7153 | arrays | tutorial.txt line 7153 | expected: none
dim scores(4)
fill scores with 90, 85, 77, 92
print scores                    ! 90  85  77  92
print 'scores: '; scores        ! scores: 90  85  77  92

dim grid(2, 2)
fill grid with 5
print grid                      ! 5  5   (then on the next line)  5  5

delay
---- output
90  85  77  92
scores: 90  85  77  92
5  5
5  5

==== x0140_arrays_7197 | arrays | tutorial.txt line 7197 | expected: none
dim raw$(4)
raw$(1) = "apple "                 ! a trailing space
raw$(2) = ""                       ! empty
raw$(3) = " pear"                  ! a leading space
raw$(4) = "ok"
print raw$                         ! apple            pear   ok   -- boundaries invisible
print array raw$: quoted           ! "apple "  ""        " pear"   "ok"

delay
---- output
apple            pear   ok
"apple "  ""        " pear"   "ok"

==== x0141_arrays_7215 | arrays | tutorial.txt line 7215 | expected: none
dim scores(*) sorted
scores(*) = 72
scores(*) = 95
scores(*) = 61
scores(*) = 88
print scores                      ! 61  72  88  95 -- no sort statement anywhere
print "lowest: "; scores(1); "  highest: "; scores(*)

dim names$(*) sorted
fill names$ with 'Pat', 'alice', 'Bob'
print names$                      ! alice  Bob    Pat -- case does not matter to the order

delay
---- output
61  72  88  95
lowest:  61   highest:  95 
alice  Bob    Pat

==== x0142_array_math_7729 | array_math | tutorial.txt line 7729 | expected: none
dim prices(4)
fill prices with 10, 20, 30, 40
dim discount(4)
fill discount with 1, 2, 3, 4
dim due(*)
due = prices - discount           ! array with array: 9, 18, 27, 36
due = due * 1.12                  ! in place, 12% tax: 10.08, 20.16, 30.24, 40.32
due = due + 5                     ! a flat 5.00 delivery charge
print due                         ! 15.08  25.16  35.24  45.32

delay
---- output
15.08  25.16  35.24  45.32

==== x0143_array_math_7780 | array_math | tutorial.txt line 7780 | expected: none
dim scores(6)
fill scores with 45, 72, 60, 88, 59, 95
dim passes(*)
passes = scores >= 60
print passes                      ! 0  1  1  1  0  1
print stats$sum(scores >= 60)     ! 4      -- summing a mask counts it
print (scores >= 60) * scores     !  0  72  60  88   0  95
print (scores > 50) and (scores < 90)   ! 0  1  1  1  1  0

delay
---- output
0  1  1  1  0  1
 4 
 0  72  60  88   0  95
0  1  1  1  1  0

==== x0144_array_math_7805 | array_math | tutorial.txt line 7805 | expected: none
dim d(3)
fill d with 0.1, 0.2, 0.3
print d * 3                       ! 0.3  0.6  0.9
print d * 3 = 0.3                 ! 1  0  0   -- 0.1 * 3 IS 0.3

delay
---- output
0.3  0.6  0.9
1  0  0

==== x0145_array_math_7821 | array_math | tutorial.txt line 7821 | expected: none
dim dice(*)
fill dice with 1000 of rnd(6)     // throw 1,000 dice: rnd(6) is drawn per die
print 'Dice over 3:'; stats$sum(dice > 3)
// Output: Dice over 3: 510        (a different count each run, near 500)

delay
---- output
Dice over 3: 504

==== x0146_array_math_7831 | array_math | tutorial.txt line 7831 | expected: none
n = 10_000_000
dim scores(n)
scores = rnd(seq(1, n) * 0 + 100)          ! ten million random scores 1..100
passes = stats$sum(scores >= 60)           ! 0.36 s on one machine
late   = stats$sum(scores < 60 and scores > 40)
c = 0                                      ! the same count as a loop: 0.77 s
for i = 1 to n
  if scores(i) >= 60 then c = c + 1
next i

delay
---- output


==== x0147_array_math_7877 | array_math | tutorial.txt line 7877 | expected: none
dim v(*)
fill v with 1, 0, 0, 0
dim ident(*)
ident = reshape(v, 3, 3, recycle: true)    ! 1, 0, 0
                                            ! 0, 1, 0
                                            ! 0, 0, 1
dim p(*)
fill p with 1, 0
print reshape(p, 5, recycle: true)         ! 1  0  1  0  1
print reshape(p, 2, 2)                      ! 1  0   -- no recycling: the two
                                            ! 0  0      elements, then zeros

                                            delay
---- output
1  0  1  0  1
1  0
0  0

==== x0150_array_math_7931 | array_math | tutorial.txt line 7931 | expected: none
dim x(*)
fill x with 1, 2, 3, 4, 5, 6
redim x(2, 3)                     ! x(1,1)=1 ... x(2,3)=6
redim x(*)                        ! back to one dimension, all six kept
redim x(8)                        ! eight live elements (7 and 8 are zero), still expandable

delay
---- output


==== x0151_array_math_7949 | array_math | tutorial.txt line 7949 | expected: none
dim grid(2, 3)
fill grid with 1, 2, 3, 4, 5, 6
dim flat(*)
flat = reshape(grid)              ! 1, 2, 3, 4, 5, 6 -- one dimension, storage order

delay
---- output


==== x0152_array_math_7996 | array_math | tutorial.txt line 7996 | expected: none
dim scores(*)
fill scores with 55, 72, 38, 90, 61
dim passing(*)
passing = filter(scores, scores >= 60)     ! 72, 90, 61
print size(passing)                         ! 3
print stats$mean(filter(scores, scores >= 60))
dim names$(*)
fill names$ with "ann", "bob", "cy", "dee", "eve"
print filter(names$, scores >= 60)          ! bob  dee  eve

delay
---- output
 3 
 74.3333333333333333 
bob  dee  eve

==== x0153_array_math_8015 | array_math | tutorial.txt line 8015 | expected: none
dim names$(*), heights(*)
fill names$ with "Ann", "Ben", "Cal", "Dot", "Eve"
fill heights with 132, 118, 145, 96, 121
print stats$mean(filter(heights, heights < 120))   ! 107  -- average height of those turned away
print filter(names$, heights >= 120)                ! Ann  Cal  Eve  -- who may ride

delay
---- output
 107 
Ann  Cal  Eve

==== x0155_array_math_8073 | array_math | tutorial.txt line 8073 | expected: none
dim fruits$(*)
fill fruits$ with "apple", "pear", "blueberry", "strawberry"
dim grid$(*)
grid$ = reshape(fruits$, 2, 2)              ! apple, pear
                                            ! blueberry, strawberry
print transpose(grid$)                      ! apple       blueberry
                                            ! pear        strawberry
dim copy$(*)
copy$ = fruits$                             ! an independent copy
print reshape(fruits$, 3, 2)                ! the missing two are ""

delay
---- output
apple       blueberry
pear        strawberry
apple       pear
blueberry   strawberry

==== x0156_array_math_8120 | array_math | tutorial.txt line 8120 | expected: none
dim a(2, 3)
fill a with 1, 2, 3, 4, 5, 6
dim b(3, 2)
fill b with 7, 8, 9, 10, 11, 12
dim z(*)
z = matmul(a, b)
print z                           !  58   64
                                  ! 139  154

                                  delay
---- output
 58   64
139  154

==== x0159_array_math_8191 | array_math | tutorial.txt line 8191 | expected: none
dim by_month(3, 2)                ! one row per month: (beans, tea)
fill by_month with 120, 80,       ! month 1
                   150, 95,       ! month 2
                   170, 110       ! month 3
dim by_product(*)
by_product = transpose(by_month)
print by_product                  ! 120  150  170   -- beans, months 1 to 3
                                  !  80   95  110    -- tea

                                  delay
---- output
120  150  170
 80   95  110

==== x0160_array_math_8242 | array_math | tutorial.txt line 8242 | expected: none
dim sales(2, 2)
fill sales with 30, 20,           ! Monday:  30 coffees, 20 muffins
                25, 30            ! Tuesday: 25 coffees, 30 muffins
dim takings(2)
fill takings with 130, 145        ! the totals: Monday 130.00, Tuesday 145.00
dim price(*)
price = solve(sales, takings)
print price                       !  2.5  2.75  -- coffee, muffin

delay
---- output
 2.5  2.75

==== x0162_array_math_8462 | array_math | tutorial.txt line 8462 | expected: none
dim fleet(3, 3)
fill fleet with 1,   1,   1,      ! vehicles:  one each
                1,   2,   5,      ! tons:      van 1, truck 2, lorry 5
              100, 150, 400       ! cost/day:  van 100, truck 150, lorry 400
dim facts(3)
fill facts with 8, 21, 1650      ! the totals: 8 vehicles, 21 tons, 1650 a day
dim count(*)
count = solve(fleet, facts)
print count                       ! 1  5  2  -- vans, trucks, lorries

delay
---- output
1  5  2

==== x0165_array_math_8539 | array_math | tutorial.txt line 8539 | expected: none
dim design(6, 2)                  ! one row per month: (month, 1)
fill design with 1, 1,  2, 1,  3, 1,  4, 1,  5, 1,  6, 1
                                  ! month multiplies the slope, the 1 the intercept
dim sales(6)
fill sales with 13, 13, 15, 19, 20, 22   ! the six monthly figures, same order
dim fit(*)
fit = solve(matmul(transpose(design), design), matmul(transpose(design), sales))
print fit                         !  2  10
print fit(1) * 7 + fit(2)         ! 24: fit(1) is the slope, fit(2) the intercept

delay
---- output
 2  10
 24

==== x0167_array_math_8609 | array_math | tutorial.txt line 8609 | expected: none
dim profit(2)
fill profit with 2.50, 2.75          ! per croissant, per muffin
dim use(3, 2)
fill use with 0.5, 0.4,              ! flour, kg
              1,   1,                ! oven slots
              0.2, 0.5               ! eggs
dim have(3)
fill have with 100, 220, 80          ! this morning's flour, slots, eggs
dim plan(*)
plan = maximize(profit, use, have)
print plan                           !  100  120        -- croissants, muffins
print dot(profit, plan)              !  580             -- the day's best profit
print have - matmul(use, plan)       !  2  0  0         -- flour left; ovens and eggs used up

delay
---- output
100  120
 580 
2  0  0

==== x0168_array_math_8698 | array_math | tutorial.txt line 8698 | expected: none
dim stamps(2)
fill stamps with 3, 5                ! 3-cent and 5-cent stamps
dim how(*), trade(*)
how = diophantine(stamps, 47)
print how                            !  4  7           -- 4 threes and 7 fives make 47
trade = lattice(stamps)
print trade                          !  -5   3         -- trade 5 threes for 3 fives and it still makes 47
print how + trade[1, *]              !  -1  10         -- the next solution along the lattice (a negative count: not usable)
print how - trade[1, *]              !  9  4           -- and the one before it: 9 threes and 4 fives
print gcd(6, 9)                      !  3              -- boxes of 6 and 9 can only make multiples of 3 ...

delay
---- output
4  7
-5   3
-1  10
9  4
 3

==== x0169_array_math_8710 | array_math | tutorial.txt line 8710 | expected: none
dim boxes(2)
fill boxes with 6, 9
when exception in
  how = diophantine(boxes, 20)       ! ... so 20 is impossible
use
  print extext$                      ! No whole-number solution
  print _string$                     ! diophantine(): the gcd of the coefficients, 3, does not divide 20 -- no whole-number solution
end when

delay
---- output
This function produces an ARRAY: assign it to an expandable array or use it inside an array expression
diophantine(a, c) produces an array (a whole-number solution x): assign it to an expandable array -- dim x(*) -- or use it inside an array expression

==== x0170_array_math_8741 | array_math | tutorial.txt line 8741 | expected: none
dim eqs(1, 3)
fill eqs with 3, 6, 9                ! one equation in three unknowns: 3x + 6y + 9z = 12
dim totals(1)
fill totals with 12
print diophantine(eqs, totals)       !  1  0  1
print lattice(eqs)                   !  -1  -1   1      -- two free directions
                                     !  -2   1   0

                                     delay
---- output
1  0  1
-1  -1   1
-2   1   0

==== x0172_array_math_8814 | array_math | tutorial.txt line 8814 | expected: none
dim orders(3, 3)
fill orders with 2, 1, 1,          ! receipt 1: 2 coffee, 1 tea, 1 muffin
                 1, 3, 0,          ! receipt 2: 1 coffee, 3 tea
                 0, 1, 2           ! receipt 3: 1 tea, 2 muffin
dim totals(3)
fill totals with 10.75, 10.75, 8.75
print determinant(orders)          ! 11  -- not zero: the receipts are enough
print solve(orders, totals)        !  2.5  2.75     3  -- coffee, tea, muffin

delay
---- output
 11 
 2.5  2.75     3

==== x0174_array_math_8856 | array_math | tutorial.txt line 8856 | expected: none
dim mix(3, 3)
fill mix with 0.4, 0.1, 0.3,        ! Brazil    -- house, espresso, light
              0.3, 0.7, 0.1,        ! Colombia
              0.3, 0.2, 0.6         ! Ethiopia
dim recipe(*), week(*), blends(*)
recipe = inverse(mix)               ! once: a stock of beans into kilos of each blend
print recipe                        !    4     0    -2
                                    ! -1.5   1.5   0.5
                                    ! -1.5  -0.5   2.5
fill week with 50, 50, 50           ! this week's stock: Brazil, Colombia, Ethiopia
blends = matmul(recipe, week)
print blends                        ! 100   25   25  -- kilos of house, espresso, light
print matmul(mix, blends)           ! 50  50  50  -- the check: exactly the stock again
fill week with 80, 60, 70           ! next week: the same recipe, no new solving
print matmul(recipe, week)          ! 180    5   25
fill week with 100, 40, 40          ! too much Brazil
print matmul(recipe, week)          ! 320  -70  -70  -- a negative: no mix uses it all

delay
---- output
   4     0    -2
-1.5   1.5   0.5
-1.5  -0.5   2.5
100   25   25
50  50  50
180    5   25
320  -70  -70

==== x0175_array_math_8958 | array_math | tutorial.txt line 8958 | expected: none
dim v(3)
fill v with 2, 3, 6
print norm(v)                      ! 7   -- sqrt(4 + 9 + 36) = sqrt(49)
dim a(2), b(2)
fill a with 1, 1
fill b with 4, 5
print norm(b - a)                  ! 5   -- distance: sqrt(3^2 + 4^2)
length = v |> norm()             ! the length; the unit vector is  v / norm(v)

delay
---- output
 7 
 5

==== x0177_array_math_8985 | array_math | tutorial.txt line 8985 | expected: none
dim parcel(2)
fill parcel with 7, 4                       ! the pickup point
dim depots(3, 2)                            ! three depots, one (east, north) per row
fill depots with 2, 1,  9, 8,  6, 3
dim offset(*)
best_km = 999999
for depot = 1 to 3
  offset = depots[depot, *] - parcel        ! this depot's offset from the parcel (a row slice)
  km = norm(offset)                         ! its straight-line distance
  if km < best_km then
    best_km = km
    nearest = depot
  end if
next depot
print "send depot "; nearest; " ("; round(best_km, 2); " km away)"   ! send depot 3 (1.41 km away)

delay
---- output
send depot  3  ( 1.41  km away)

==== x0179_array_math_9039 | array_math | tutorial.txt line 9039 | expected: none
dim m(3, 2)                        ! three points, one (x, y) per row
fill m with 3, 4,  6, 8,  5, 12
print norm(m, axis: 2)             !  5  10  13   -- the length of each row
print norm(m, axis: 1)             ! ...the length of each column
print norm(m, axis: 2, kind: max)  !  4   8  12    -- a kind works per lane too

delay
---- output
 5  10  13
 8.3666002653407555  14.9666295470957655
 4   8  12

==== x0180_array_math_9071 | array_math | tutorial.txt line 9071 | expected: none
dim v(*)
fill v with -1.5, 2.25, -3
print abs(v)                       !  1.5  2.25     3
print round(v, 1)                  ! -1.5   2.3    -3
print max(v, 0)                    !    0  2.25     0
dim a(*), b(*)
fill a with 1, 5, 3
fill b with 4, 2, 6
print max(a, b)                    ! 4  5  6
print stats$sum(abs(v))            ! 6.75
dim y(*)
y = round(abs(v) * 2, 0)           ! 3, 5, 6  -- maps compose with arithmetic
dim decimals(*)
fill v with 3.14159, 2.71828, 1.41421
fill decimals with 1, 2, 3
print round(v, decimals)           !   3.1   2.72  1.414  -- each element rounded to ITS decimals

delay
---- output
 1.5  2.25     3
-1.5   2.3    -3
   0  2.25     0
4  5  6
 6.75 
  3.1   2.72  1.414

==== x0181_array_math_9128 | array_math | tutorial.txt line 9128 | expected: none
dim names$(*)
fill names$ with "cy", "Ann", "bob"
print ucase$(names$)               ! CY   ANN  BOB
print len(names$)                  ! 2  3  3
print filter(names$, len(names$) > 2)          ! Ann  bob
dim clean$(*)
clean$ = ucase$(trim$(names$))     ! maps nest
print stats$sum(len(names$))       ! 8

delay
---- output
CY   ANN  BOB
2  3  3
Ann  bob
 8

==== x0182_array_math_9153 | array_math | tutorial.txt line 9153 | expected: none
dim words$(*), lens(*), starts(*), counts(*), needles$(*), widths(*)
fill words$ with "apple", "banana", "cherry"
fill lens with 1, 3, 2
fill starts with 2, 1, 3
fill counts with 1, 2, 3
fill needles$ with "p", "n", "y"
fill widths with 6, 8, 7
print left$(words$, lens)          ! a    ban  ch
print mid$(words$, starts, lens)   ! p    ban  er
print mid$(words$, starts, 2)      ! pp  ba  er         -- a single value for every element
print repeat$(words$, counts)      ! apple               bananabanana        cherrycherrycherry
print pos(words$, needles$)        ! 2  3  6            -- two string arrays, a REAL result
print lpad$(words$, widths)        !  apple      banana   cherry
print len(left$(words$, lens))     ! 1  3  2            -- maps nest across types
print left$("hello", lens)         ! h    hel  he         -- one string, each length in turn
print round(3.14159, lens)         !   3.1  3.142   3.14   -- one number, each precision in turn

delay
---- output
a    ban  ch
p    ban  er
pp  ba  er
apple               bananabanana        cherrycherrycherry
2  3  6
 apple      banana   cherry
1  3  2
h    hel  he
  3.1  3.142   3.14

==== x0184_array_math_9204 | array_math | tutorial.txt line 9204 | expected: none
dim x$(*), y(*), v(*), z$(*), w(*), p(*)
fill x$ with "Apples", "banana", "pear"
fill y with 3, 1, 2
z$ = x$[y]                         ! pear, Apples, banana
fill v with 10, 20, 30
print v[y]                         ! 30  10  20
fill y with 1, 3
v[y] = 9                           ! v is now 9, 20, 9

! an array on the right: pair each value with its position
fill v with 10, 20, 30
fill y with 3, 1                   ! positions
fill w with 300, 100              ! the values for them
v[y] = w                           ! v is now 100, 20, 300

! x[p] = x reorders in place (p is a permutation)
fill v with 11, 22, 33
fill p with 3, 1, 2                ! send v(1)->3, v(2)->1, v(3)->2
v[p] = v                           ! v is now 22, 33, 11

delay
---- output
30  10  20

==== x0185_array_math_9245 | array_math | tutorial.txt line 9245 | expected: none
dim v(*)
fill v with 10, 20, 30, 40, 50, 60, 70
print v[2:4]                       ! 20  30  40
print v[5:*]                       ! 50  60  70   -- to the last
print v[:3]                        ! 10  20  30   -- from the first
print v[*-2:*]                     ! 50  60  70   -- the last three
print v[1:*:2]                     ! 10  30  50  70   -- every other
print v[*:1:-1]                    ! 70  60  ...  10   -- reversed
print v[6:20]                      ! 60  70   -- the range clamps to what is there

delay
---- output
20  30  40
50  60  70
10  20  30
50  60  70
10  30  50  70
70  60  50  40  30  20  10
60  70

==== x0187_array_math_9312 | array_math | tutorial.txt line 9312 | expected: none
dim names$(*), ages(*), idx(*)
fill names$ with "cy", "Ann", "bob", "dee"
fill ages with 31, 25, 40, 25
print sortindex(names$)                        ! 2  3  1  4
print names$[sortindex(names$)]                ! Ann  bob  cy   dee
print names$[sortindex(ages)]                  ! Ann  dee  cy   bob  -- by age, ties in order
print names$[sortindex(ages, descending: true)]   ! bob  cy   Ann  dee
idx = sortindex(names$, nocase: false)         ! exact: upper case sorts first

delay
---- output
2  3  1  4
Ann  bob  cy   dee
Ann  dee  cy   bob
bob  cy   Ann  dee

==== x0189_array_math_9363 | array_math | tutorial.txt line 9363 | expected: none
dim times(4), order(*), place(4)
fill times with 41.2, 38.9, 45.0, 39.5     ! runners A, B, C, D
order = sortindex(times)                    ! 2, 4, 1, 3  -- B fastest, then D, A, C
place[order] = seq(1, 4)                     ! scatter: place(2)=1, place(4)=2, place(1)=3, place(3)=4
print place                                  ! 3  1  4  2  -- A 3rd, B 1st, C 4th, D 2nd

delay
---- output
3  1  4  2

==== x0190_array_math_9392 | array_math | tutorial.txt line 9392 | expected: none
dim prices(*)
fill prices with 5, -3, 8, -1
prices(prices < 0) = 0             ! 5, 0, 8, 0  -- the clamp idiom
dim m(*)
fill m with 1, 0, 1, 0
prices(m) = 100                    ! 100, 0, 100, 0;  _integer = 2
print prices(m)                    ! 100  100  -- reads as filter(prices, m)

delay
---- output
100  100

==== x0191_array_math_9409 | array_math | tutorial.txt line 9409 | expected: none
dim prices(*)
fill prices with 4.00, 2.50, 9.00, 3.00, 1.75
prices = prices - 2                ! the flat weekend discount, the whole list at once
                                   !   now  2, 0.5, 7, 1, -0.25
prices(prices < 1.50) = 1.50       ! floor: nothing sells below the minimum
print prices                       !   2  1.5    7  1.5  1.5   -- three items lifted (_integer = 3)

delay
---- output
  2  1.5    7  1.5  1.5

==== x0192_array_math_9440 | array_math | tutorial.txt line 9440 | expected: none
dim words$(*), v(*)
words$ = split("apple, pear ,fig")
print size(words$); " "; words$(2)             !  3  pear   (with its spaces)
words$ = trim$(split("apple, pear ,fig"))     ! apple, pear, fig
print join$(words$, " | ")                     ! apple | pear | fig
print join$(words$[sortindex(words$)])         ! apple,fig,pear
fill v with 1, 2.5, 30
print join$(v)                                 ! 1,2.5,30
print join$(ucase$(words$), "")                ! APPLEPEARFIG
print size(split(""))                          ! 0

delay
---- output
 3   pear 
apple | pear | fig
apple,fig,pear
1,2.5,30
APPLEPEARFIG
 0

==== x0193_array_math_9494 | array_math | tutorial.txt line 9494 | expected: none
dim sales(3, 4), row(1, 4), col(3, 1), y(*)
fill sales with 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120
fill row with 1, 2, 3, 4
fill col with 100, 200, 300
y = sales + row                   ! the 1 x 4 row is added to every row
print y                           !  11   22   33   44
                                  !  51   62   73   84
                                  !  91  102  113  124
y = sales * col                   ! the 3 x 1 column scales each row
print y                           !  1000   2000   3000   4000
                                  ! 10000  12000  14000  16000
                                  ! 27000  30000  33000  36000

                                  delay
---- output
 11   22   33   44
 51   62   73   84
 91  102  113  124
 1000   2000   3000   4000
10000  12000  14000  16000
27000  30000  33000  36000

==== x0199_array_math_9612 | array_math | tutorial.txt line 9612 | expected: none
dim qty(*), price(*)
fill qty with 3, 1, 4
fill price with 2.5, 10, 0.75
print dot(qty, price)             ! 20.5   -- 3 * 2.5 + 1 * 10 + 4 * 0.75
print stats$sum(qty * price)      ! 20.5   -- the same, through a temporary array
dim a(*), b(*)
fill a with 1, 2, 2
fill b with 2, 4, 4
print dot(a, a)                   ! 9      -- the squared length of a
print dot(a, b) / (sqrt(dot(a, a)) * sqrt(dot(b, b)))   ! 1   -- cosine similarity: b is a scaled a

delay
---- output
 20.5 
 20.5 
 9 
 1

==== x0200_array_math_9643 | array_math | tutorial.txt line 9643 | expected: none
dim g(4, 3)                       ! id, qty, amount
fill g with 101, 5, 30, 102, 12, 55, 103, 3, 20, 104, 9, 41
print filter(g, g[*, 2] > 4, axis: 1)      ! 101    5   30   -- the rows with qty over 4
                                           ! 102   12   55
                                           ! 104    9   41
dim keepcol(*)
fill keepcol with 1, 0, 1
print filter(g, keepcol, axis: 2)          ! 101   30       -- columns 1 and 3 of every row
                                           ! 102   55
                                           ! 103   20
                                           ! 104   41
print filter(g, g > 50)                    ! 101  102   55  103  104   -- no axis: a flat list

delay
---- output
101    5   30
102   12   55
104    9   41
101   30
102   55
103   20
104   41
101  102   55  103  104

==== x0201_array_math_9678 | array_math | tutorial.txt line 9678 | expected: none
dim first$(*), last$(*), full$(*), ages(*)
fill first$ with "Ann", "Ben", "Cal"
fill last$ with "Lee", "Moe", "Dee"
fill ages with 31, 42, 53
full$ = first$ + " " + last$
print full$                           ! Ann Lee  Ben Moe  Cal Dee
print "Dr " + first$                  ! Dr Ann  Dr Ben  Dr Cal
print first$ + " (" + str$(ages) + ")"   ! Ann (31)  Ben (42)  Cal (53)
print ucase$(first$ + "!")            ! ANN!  BEN!  CAL!
print len(first$ + last$)             ! 6  6  6
print join$(first$ + "-" + last$, " | ")   ! Ann-Lee | Ben-Moe | Cal-Dee

delay
---- output
Ann Lee  Ben Moe  Cal Dee
Dr Ann  Dr Ben  Dr Cal
Ann (31)  Ben (42)  Cal (53)
ANN!  BEN!  CAL!
6  6  6
Ann-Lee | Ben-Moe | Cal-Dee

==== x0202_array_math_9712 | array_math | tutorial.txt line 9712 | expected: none
dim names$(*)
fill names$ with "ann", "bob", "Bob", "cy"
print names$ = "bob"                      ! 0  1  0  0        -- byte-exact
print filter(names$, names$ = "bob")      ! bob               -- the string-column filter
print stats$sum(names$ <> "ann")          ! 3                 -- how many are not ann
print names$ < "c"                        ! 1  1  1  0        -- the scalar order: B before a..z
print same(names$, "bob")                 ! 0  1  1  0        -- case-blind: same() maps
names$(names$ = "bob") = "robert"         ! the masked store: replace one value
print names$                              ! ann     robert  Bob     cy

delay
---- output
0  1  0  0
bob
 3 
1  1  1  0
0  1  1  0
ann     robert  Bob     cy

==== x0203_array_math_9744 | array_math | tutorial.txt line 9744 | expected: none
dim scores(*), names$(*)
fill scores with 72, 95, 61, 95, 40
fill names$ with "ann", "bob", "cy", "dee", "eve"
print stats$argmax(scores)              ! 2      -- the first 95 (ties go to the first)
print names$[stats$argmax(scores)]      ! bob    -- who owns it
print stats$argmin(scores)              ! 5
print scores[stats$argmin(scores)]      ! 40     -- the value there, the long way round

delay
---- output
 2 
bob
 5 
 40

==== x0204_array_math_9758 | array_math | tutorial.txt line 9758 | expected: none
dim h(2, 4)
fill h with 5, 1, 9, 2, 9, 0, 7, 3
print h                                 ! 5  1  9  2
                                        ! 9  0  7  3
print stats$argmax(h)                   ! 3      -- the first 9, counting along the rows
print stats$argmax(h, axis: 1)          ! 2  1  1  2   -- per column: which row holds its maximum
print stats$argmax(h, axis: 2)          ! 3  1          -- per row: which column

delay
---- output
5  1  9  2
9  0  7  3
 3 
2  1  1  2
3  1

==== x0205_array_math_9785 | array_math | tutorial.txt line 9785 | expected: none
dim v(*), u(*)
fill v with 3, 1, 3, 2, 1, 3
u = unique(v)
print u                                 ! 3  1  2      -- first-occurrence order
print sort(unique(v))                   ! 1  2  3
print size(unique(v))                   ! 3            -- how many distinct values
dim s$(*)
fill s$ with "Apple", "pear", "apple", "Pear", "fig"
print unique(s$)                        ! Apple  pear   fig   -- case-blind: the first spelling is kept
print size(unique(s$, nocase: false))   ! 5            -- exact: every spelling is its own value
v = unique(v)                           ! in place: v is now 3, 1, 2

delay
---- output
3  1  2
1  2  3
 3 
Apple  pear   fig
 5

==== x0206_array_math_9822 | array_math | tutorial.txt line 9822 | expected: none
dim r1(*), r2(*), r3(*), t(*)
fill r1 with 1, 2, 3
fill r2 with 4, 5, 6
fill r3 with 7, 8, 9
t = stack(r1, r2, r3)                   ! a 3 x 3 table, one vector per row
print t                                 ! 1  2  3
                                        ! 4  5  6
                                        ! 7  8  9
dim g(2, 3), c(2, 1)
fill g with 1, 2, 3, 4, 5, 6
fill c with 100, 200
print stack(g, c, axis: 2)              !   1    2  100     -- a column added to a table
                                        !   3    4  200
print stack(r1, r2, axis: 2)            ! 1  2  3  4  5  6  -- vectors side by side: one longer vector

delay
---- output
1  2  3
4  5  6
7  8  9
  1    2    3  100
  4    5    6  200
1  2  3  4  5  6

==== x0207_array_math_9862 | array_math | tutorial.txt line 9862 | expected: none
dim a(*), b(*)
fill a with 1, 2, 3, 4, 5
fill b with 4, 2, 9
print isin(a, b)                        ! 0  1  0  1  0
print filter(a, isin(a, b))             ! 2  4                -- in both
print filter(a, not isin(a, b))         ! 1  3  5             -- in a only
print unique(stack(a, b, axis: 2))      ! 1  2  3  4  5  9    -- the union: end to end, then distinct
dim names$(*), vips$(*)
fill names$ with "Ann", "bob", "Cy", "dee"
fill vips$ with "BOB", "cy", "zed"
print filter(names$, isin(names$, vips$))    ! bob  Cy         -- case-blind

delay
---- output
0  1  0  1  0
2  4
1  3  5
1  2  3  4  5  9
bob  Cy

==== x0208_maximize_and_minimize_10651 | maximize_and_minimize | tutorial.txt line 10651 | expected: none
maximize profit = 35 * benches + 15 * stools
  where benches, stools are whole
  subject to
    boards:   5 * benches + 2 * stools <= 29    ! oak boards on hand
    hours:    2 * benches + 6 * stools <= 36    ! shop hours this week
end maximize

print 'Build '; benches; ' benches and '; stools; ' stools'
print 'Profit: '; profit
print 'boards left: '; boards
print 'hours left:  '; hours

delay
---- output
Build  5  benches and  2  stools
Profit:  205 
boards left:  0 
hours left:   14

==== x0211_maximize_and_minimize_10749 | maximize_and_minimize | tutorial.txt line 10749 | expected: none
maximize profit = 35 * benches + 15 * stools
  where benches, stools are decimal
  subject to
    boards:   5 * benches + 2 * stools <= 29
    hours:    2 * benches + 6 * stools <= 36
end maximize
print 'Build '; benches; ' benches and '; stools; ' stools'
print 'Profit: '; profit

delay
---- output
Build  3.9230769230769231  benches and  4.6923076923076923  stools
Profit:  207.6923076923076923

==== x0213_maximize_and_minimize_10801 | maximize_and_minimize | tutorial.txt line 10801 | expected: none
maximize profit = 80 * benches + 10 * finish
  where benches are whole, finish are decimal
  subject to
    budget: 120 * benches + 30 * finish <= 700   ! dollars: a bench's materials, a litre of finish
    coats:  finish <= 2.5 * benches               ! no more than 2.5 litres per bench
end maximize
print 'Build '; benches; ' benches with '; finish; ' litres of finish, profit '; profit

delay
---- output
Build  5  benches with  3.3333333333333333  litres of finish, profit  433.3333333333333333

==== x0215_maximize_and_minimize_10832 | maximize_and_minimize | tutorial.txt line 10832 | expected: none
const bench_profit = 35
const stool_profit = 15
boards_on_hand = 29
hours_on_hand = 36
overhead = 100
maximize net = bench_profit * benches + stool_profit * stools - overhead
  where benches, stools are whole
  subject to
    boards: 5 * benches + 2 * stools <= boards_on_hand
    hours:  2 * benches + 6 * stools <= hours_on_hand
    demand: benches + stools >= 8                 ! at least eight pieces this week
end maximize
print 'Build '; benches; ' benches and '; stools; ' stools, net '; net

delay
---- output
Build  4  benches and  4  stools, net  100

==== x0219_maximize_and_minimize_10904 | maximize_and_minimize | tutorial.txt line 10904 | expected: none
minimize cost = 10 * day_shifts + 12 * night_shifts
  where day_shifts, night_shifts are whole
  subject to
    coverage: 3 * day_shifts + 2 * night_shifts >= 17   ! coverage points needed
    day_shifts <= 4
    night_shifts <= 6
end minimize
print 'Schedule '; day_shifts; ' day shifts and '; night_shifts; ' night shifts, cost '; cost

delay
---- output
Schedule  4  day shifts and  3  night shifts, cost  76

==== x0221_maximize_and_minimize_10944 | maximize_and_minimize | tutorial.txt line 10944 | expected: none
maximize profit = 20 * brackets + 30 * hinges
  then minimize steel_used = 1 * brackets + 2 * hinges
  where brackets, hinges are whole
  subject to
    machine: 2 * brackets + 3 * hinges <= 60
    steel:   1 * brackets + 2 * hinges <= 50
    order:   hinges >= 4
end maximize

print 'Make '; brackets; ' brackets and '; hinges; ' hinges'
print 'Profit: '; profit; '  Steel used: '; steel_used; ' kg'

delay
---- output
Make  24  brackets and  4  hinges
Profit:  600   Steel used:  32  kg

==== x0223_maximize_and_minimize_11001 | maximize_and_minimize | tutorial.txt line 11001 | expected: none
maximize profit = 20 * brackets + 30 * hinges
  where brackets, hinges are whole
  subject to
    machine: 2 * brackets + 3 * hinges <= 60
    steel:   1 * brackets + 2 * hinges <= 50
    order:   hinges >= 4
end maximize

minimize steel_used = 1 * brackets + 2 * hinges
  where brackets, hinges are whole
  subject to
    machine: 2 * brackets + 3 * hinges <= 60
    steel:   1 * brackets + 2 * hinges <= 50
    order:   hinges >= 4
    keep:    20 * brackets + 30 * hinges >= profit  ! no less than the maximum
end minimize

print 'Make '; brackets; ' brackets and '; hinges; ' hinges'
print 'Profit: '; profit; '  Steel used: '; steel_used; ' kg'

delay
---- output
Make  24  brackets and  4  hinges
Profit:  600   Steel used:  32  kg

==== x0225_maximize_and_minimize_11057 | maximize_and_minimize | tutorial.txt line 11057 | expected: none
maximize profit = 35 * benches + 15 * stools
  where benches, stools are decimal
  subject to
    boards:   5 * benches + 2 * stools <= 29
    hours: 2 * benches + 6 * stools <= 36
end maximize
print 'one more board is worth  '; boards_worth
print 'one more hour is worth   '; hours_worth
print 'check: '; boards_worth * 29 + hours_worth * 36; ' = '; profit

delay
---- output
one more board is worth   6.9230769230769231 
one more hour is worth    0.1923076923076923 
check:  207.6923076923076923  =  207.6923076923076923

==== x0227_maximize_and_minimize_11092 | maximize_and_minimize | tutorial.txt line 11092 | expected: none
minimize cost = 10 * day_shifts + 12 * night_shifts
  where day_shifts, night_shifts are decimal
  subject to
    coverage: 3 * day_shifts + 2 * night_shifts >= 17
    daycap:   day_shifts <= 4
    nightcap: night_shifts <= 6
end minimize
print 'one more point of coverage costs '; coverage_worth
print 'one more day shift allowed saves '; 0 - daycap_worth
print 'nightcap has '; nightcap; ' shifts of room, worth '; nightcap_worth

delay
---- output
one more point of coverage costs  6 
one more day shift allowed saves  8 
nightcap has  3.5  shifts of room, worth  0

==== x0229_maximize_and_minimize_11139 | maximize_and_minimize | tutorial.txt line 11139 | expected: none
when exception in
  maximize made = a + b
    where a, b are whole
    subject to
      2 * a + 2 * b = 3
  end maximize
use
  print exceptionname$(extype); ': '; _string$
end when

delay
---- output
INFEASIBLE: maximize(): the constraints have a decimal plan but no whole-number plan (9 linear programs searched)

==== x0231_maximize_and_minimize_11175 | maximize_and_minimize | tutorial.txt line 11175 | expected: none
dim c(2), usage(2, 2), limits(2), plan(*)
fill c with 35, 15
fill usage with 5, 2,
                2, 6
fill limits with 29, 36
plan = maximize(c, usage, limits, whole: true)
print 'plan:   '; plan
print 'profit: '; dot(c, plan)
print 'used:   '; matmul(usage, plan)

delay
---- output
plan:   5  2
profit:  205 
used:   29  22

==== x0235_outer_product_11301 | outer_product | tutorial.txt line 11301 | expected: none
dim x(4), y(3)
fill x with seq(1, 4)
fill y with seq(1, 3)
print outer(x, y, *)

delay
---- output
 1   2   3
 2   4   6
 3   6   9
 4   8  12

==== x0243_outer_product_11401 | outer_product | tutorial.txt line 11401 | expected: none
dim v(1), decimals(3)
fill v with 1.2345
fill decimals with 0, 1, 2
print outer(v, decimals, round())      !    1   1.2  1.23

delay
---- output
   1   1.2  1.23

==== x0245_outer_product_11442 | outer_product | tutorial.txt line 11442 | expected: none
dim x(*)
fill x with 3, 1, 6, 2, 5
dim names$(*)
fill names$ with 'apples', 'pears', 'blueberrys', 'oranges'
print x
print outer(names$, x, left$())

delay
---- output
3  1  6  2  5
app     a       apples  ap      apple
pea     p       pears   pe      pears
blu     b       bluebe  bl      blueb
ora     o       orange  or      orang

==== x0247_outer_product_11469 | outer_product | tutorial.txt line 11469 | expected: none
dim names$(3)
fill names$ with "hello", "jello", "world"
print outer(names$, names$, compare())

delay
---- output
100   92    0
 92  100    0
  0    0  100

==== x0249_reduce_scan_11587 | reduce_scan | tutorial.txt line 11587 | expected: none
dim v(*)
fill v with 3, 1, 6, 2, 5
print reduce(v, +)          ! 17    -- the sum
print reduce(v, *)          ! 180   -- the product
print reduce(v, max())      ! 6
print reduce(v, min())      ! 1
print reduce(v, -)          ! -11   -- ((((3 - 1) - 6) - 2) - 5), left to right

delay
---- output
17
180
6
1
-11

==== x0251_reduce_scan_11621 | reduce_scan | tutorial.txt line 11621 | expected: none
dim factors(*)
fill factors with 1.05, 1.03, 0.98, 1.08     ! +5%, +3%, -2%, +8%
print reduce(factors, *)                      ! 1.1446596   -- the total growth factor
print 1000 * reduce(factors, *)               ! 1144.6596   -- what the 1000 becomes

delay
---- output
1.1446596
1144.6596

==== x0255_reduce_scan_11697 | reduce_scan | tutorial.txt line 11697 | expected: none
dim g(2, 3)
fill g with 1, 2, 3, 4, 5, 6
print reduce(g, +)             !  6  15     -- the last axis: one value per row
print reduce(g, +, axis: 1)    ! 5  7  9   -- down the rows: one value per column
print reduce(g, max(), axis: 2)   ! 3  6
print reduce(g, +, all: true)  ! 21        -- every cell

print scan(g, +, axis: 2)      !  1   3   6      -- scan keeps the shape
                               !  4   9  15

                               delay
---- output
 6  15
5  7  9
3  6
21
 1   3   6
 4   9  15

==== x0256_reduce_scan_11720 | reduce_scan | tutorial.txt line 11720 | expected: none
dim x(4), y(3)
fill x with seq(1, 4)
fill y with seq(1, 3)
print reduce(outer(x, y, *), +, all: true)   ! 60  -- the whole table summed
print reduce(outer(x, y, >), +, all: true)   ! 6   -- how many pairs have x > y
print reduce(outer(x, y, *), +, axis: 2) !  6  12  18  24   -- row by row

delay
---- output
60
6
 6  12  18  24

==== x0257_reduce_scan_11735 | reduce_scan | tutorial.txt line 11735 | expected: none
dim big(*)
fill big with seq(1, 100_000)
print reduce(big, *)

delay
---- output
2.824229407960347874293421578024535518477494926091224850578917944e+456573

==== x0259_complex_numbers_11873 | complex_numbers | tutorial.txt line 11873 | expected: none
z = 3 + 4i
print z, typeof$(z)                     !  3+4i   Name:Z, Dtype:Real, *Complex*
print real(z), imag(z), abs(z), conj(z) !  3  4  5  3-4i
print z * (1 - 2i), z / (1 - 2i)        !  11-2i  -1+2i
print z + 1, 2 * z                      !  4+4i  6+8i       -- a real is promoted
print complex(1.5, -2), val("2.5-0.5i") !  1.5-2i  2.5-0.5i
print 4i * 4i                           !  -16+0i           -- i squared is -1
print round(arg(z), 6), round(arg(1i), 6), round(arg(-1), 6)   !  0.927295  1.570796  3.141593
print z = 3 + 4i, z <> 3 + 4i, (3 + 0i) = 3   !  1  0  1  -- = and <> compare both parts

delay
---- output
 3+4i Name:Z, Dtype:Real, *Complex*
 3  4  5  3-4i 
 11-2i -1+2i 
 4+4i  6+8i 
 1.5-2i  2.5-0.5i 
-16+0i 
 0.927295  1.570796  3.141593 
 1  0  1

==== x0260_complex_numbers_11907 | complex_numbers | tutorial.txt line 11907 | expected: none
third = (1 + 2i) / 3
print third                       !  0.3333333333333333+0.6666666666666667i
print sprintf$("%.30r", third)    !  0.333333333333333333333333333333+0.666666666666666666666666666667i
print sprintf$("%.6r", third)     !  0.333333+0.666667i
big = 1e4000 + 2e-4000i
print big                         !  1e+4000+2e-4000i
print big * big                   !  1e+8000+4i         -- the cross term is exact: 2 * 1e4000 * 2e-4000
print abs(1e8000 + 1e8000i)       !  1.41421356237309504880168872421e+8000
w = 1e20 + 1i
print (w + 1) - w                 !  1+0i               -- a double would have lost the 1
w = 1e30 + 1i
print (w + 1) - w                 !  0+0i               -- past 30 digits, so does this
print (1 + 1e-29i) * (1 - 1e-29i) !  1+0i               -- 1 + 1e-58 rounds to 1 at 30 digits

delay
---- output
 0.3333333333333333+0.6666666666666667i 
0.333333333333333333333333333333+0.666666666666666666666666666667i
0.333333+0.666667i
 1e+4000+2e-4000i 
 1e+8000+4i 
 1.41421356237309504880168872421e+8000 
 1+0i 
 0+0i 
 1+0i

==== x0261_complex_numbers_11933 | complex_numbers | tutorial.txt line 11933 | expected: none
huge = 1e8000 + 0i
when exception in
  y = huge * huge
use
  print extype; " "; extext$        !  -4105 Numeric overflow
end when
print -complex(0, 0), conj(-4 + 0i) !  -0-0i  -4-0i

delay
---- output
-4105  Numeric overflow
-0-0i -4-0i

==== x0262_complex_numbers_11965 | complex_numbers | tutorial.txt line 11965 | expected: none
volts = 120 + 0i
resistance = 40
inductive = 30
capacitive = 10
impedance = resistance + (inductive - capacitive) * 1i
current = volts / impedance
print impedance, current                                     !  40+20i  2.4-1.2i
print round(abs(current), 4), round(arg(current) * 180 / pi, 2)   !  2.6833  -26.57   -- amps, degrees lagging
apparent = volts * conj(current)
print round(real(apparent), 2), round(imag(apparent), 2), round(abs(apparent), 2)   !  288  144  321.99

delay
---- output
 40+20i  2.4-1.2i 
 2.6833 -26.57 
 288  144  321.99

==== x0263_complex_numbers_11984 | complex_numbers | tutorial.txt line 11984 | expected: none
point = 3 + 1i
print point * 1i, point * 1i * 1i                    !  -1+3i  -3-1i   -- a quarter turn, then a half
print point * complex(cos(pi / 6), sin(pi / 6))      !  2.098076211353317+2.366025403784439i   -- 30 degrees

delay
---- output
-1+3i -3-1i 
 2.098076211353317+2.366025403784439i

==== x0264_complex_numbers_11996 | complex_numbers | tutorial.txt line 11996 | expected: none
routine escape_count with c, returning n
  zz = 0 + 0i
  n = 0
  do while n < 50
    zz = zz * zz + c
    if abs(zz) > 2 then exit do
    n = n + 1
  loop
end routine

print escape_count(c = 0 + 0i), escape_count(c = -1 + 0i), escape_count(c = 1 + 1i)   !  50  50  1
line$ = ""
for k = -20 to 10
  cc = complex(k / 10, 0.45)
  if escape_count(c = cc) >= 50 then line$ = line$ + "#" else line$ = line$ + "."
next k
print line$                       !  ...............########........
---- output
 50  50  1 
...............########........

==== x0265_complex_numbers_12025 | complex_numbers | tutorial.txt line 12025 | expected: none
dim z(*), m(*), w(*)
fill z with 1 + 2i, 3 - 1i, 0.5 + 0.5i
print z                    !  1+2i  3-1i  0.5+0.5i
print z * z                !  -3+4i  8-6i  0+0.5i
print z * 1i               !  -2+1i  1+3i  -0.5+0.5i     -- every element a quarter turn
print abs(z)               !  2.2360679774997897  3.1622776601683793  0.7071067811865475
print real(z), imag(z)     !  1  3  0.5     2  -1  0.5
print conj(z)              !  1-2i  3+1i  0.5-0.5i
print filter(z, abs(z) > 2)          !  1+2i  3-1i
print where(imag(z) < 0, z, conj(z)) !  1-2i  3-1i  0.5-0.5i    -- fold everything below the axis
print stats$sum(z), stats$mean(z)    !  4.5+1.5i  1.5+0.5i
print reduce(z, *)         !  0+5i
dim re(*), im(*)
fill re with 1, 2, 3
fill im with 4, 5, 6
print complex(re, im)      !  1+4i  2+5i  3+6i

delay
---- output
    1+2i      3-1i  0.5+0.5i
 -3+4i    8-6i  0+0.5i
    -2+1i       1+3i  -0.5+0.5i
2.2360679774997897  3.1622776601683793  0.7071067811865475
  1    3  0.5  2   -1  0.5
    1-2i      3+1i  0.5-0.5i
1+2i  3-1i
    1-2i      3-1i  0.5-0.5i
 4.5+1.5i  1.5+0.5i 
0+5i
1+4i  2+5i  3+6i

==== x0266_complex_numbers_12061 | complex_numbers | tutorial.txt line 12061 | expected: none
dim a(2, 2), rhs(*)
fill a with 1 + 1i, 2, 0, 1 - 1i
fill rhs with 1, 1i
print determinant(a)       !  2+0i
print solve(a, rhs)        !  0.5-1.5i  -0.5+0.5i

delay
---- output
 2+0i 
 0.5-1.5i  -0.5+0.5i

==== x0267_complex_numbers_12081 | complex_numbers | tutorial.txt line 12081 | expected: none
dim x(*), z(*)
fill x with 1, 0, 0, 0
print fft(x)                !  1+0i  1-0i  1+0i  1+0i     -- an impulse is every tone equally
fill x with 1, 1, 1, 1
print fft(x)                !  4-0i  0+0i  0+0i  0+0i     -- a constant is only the zero tone
n = 8
redim x(n)
for k = 1 to n
  x(k) = cos(2 * pi * 2 * (k - 1) / n)   ! two cycles over the sample
next k
z = fft(x)
print round(abs(z), 6)      !  0  0  4  0  0  0  4  0    -- element 3 (k = 2) and its mirror
print fftfreq(8)            !  0  0.125  0.25  0.375  -0.5  -0.375  -0.25  -0.125
print fftfreq(8, 0.001)     !  0  125  250  375  -500  -375  -250  -125   -- samples 1 ms apart: hertz
print round(real(ifft(z)), 12)   !  1  0  -1  0  1  0  -1  0   -- and back

delay
---- output
1+0i  1+0i  1+0i  1+0i
4+0i  0+0i  0+0i  0+0i
0  0  4  0  0  0  4  0
     0   0.125    0.25   0.375    -0.5  -0.375   -0.25  -0.125
   0   125   250   375  -500  -375  -250  -125
 1   0  -1   0   1   0  -1   0

==== x0268_complex_numbers_12124 | complex_numbers | tutorial.txt line 12124 | expected: none
rate = 1000
n = 1000
dim sample(*), spectrum(*), freqs(*), power(*)
redim sample(n)
for k = 1 to n
  t = (k - 1) / rate
  sample(k) = 1.0 * sin(2 * pi * 50 * t) + 0.3 * sin(2 * pi * 120 * t) + 0.05 * (rnd(1000) - 500) / 500
next k
spectrum = fft(sample)
freqs = fftfreq(n, 1 / rate)
power = abs(spectrum) ^ 2
half = int(n / 2)
peak = stats$argmax(power[1:half])
print "strongest tone at "; freqs(peak); " Hz"    !  strongest tone at  50  Hz
power(peak) = 0
print "next at "; freqs(stats$argmax(power[1:half])); " Hz"   !  next at  120  Hz

delay
---- output
strongest tone at  50  Hz
next at  120  Hz

==== x0269_complex_numbers_12151 | complex_numbers | tutorial.txt line 12151 | expected: none
rate = 8000
n = 800
dim tone(*), tf(*), tm(*)
redim tone(n)
for k = 1 to n
  t = (k - 1) / rate
  tone(k) = sin(2 * pi * 697 * t) + sin(2 * pi * 1209 * t)
next k
tm = abs(fft(tone))
tf = fftfreq(n, 1 / rate)
first = stats$argmax(tm[1:400])
tm(first) = 0
print "the two tones: "; tf(first); " Hz and "; tf(stats$argmax(tm[1:400])); " Hz"
!  the two tones:  1210  Hz and  700  Hz

delay
---- output
the two tones:  1210  Hz and  700  Hz

==== x0270_complex_numbers_12176 | complex_numbers | tutorial.txt line 12176 | expected: none
n = 84
dim sales(*), sz(*), sf(*), sp(*), flat(*)
redim sales(n)
for d = 1 to n
  sales(d) = 1000 + 300 * cos(2 * pi * (d - 1) / 7) + 2 * d
next d
sz = fft(sales)
sf = fftfreq(n)
sp = abs(sz)
sp(1) = 0                                  ! ignore the level (the DC bin)
print "the strongest cycle repeats every "; round(1 / sf(stats$argmax(sp[1:42])), 2); " days"
!  the strongest cycle repeats every  7  days
sz(13) = 0 + 0i                            ! bin 12 (7-day) and its mirror
sz(n - 11) = 0 + 0i
flat = real(ifft(sz))
print round(sales[8:14], 0)   !  1316  1205   953   752   754   959  1215
print round(flat[8:14], 0)    !  1018  1022  1024  1022  1020  1022  1026

delay
---- output
the strongest cycle repeats every  7  days
1316  1205   953   752   754   959  1215
1018  1022  1024  1022  1020  1022  1026

==== x0271_complex_numbers_12202 | complex_numbers | tutorial.txt line 12202 | expected: none
dim noisy(*), kernel(*), smooth(*)
fill noisy with 5, 9, 4, 8, 6, 10, 5, 9
fill kernel with 0.25, 0.25, 0.25, 0.25, 0, 0, 0, 0
smooth = real(ifft(fft(noisy) * fft(kernel)))
print round(smooth, 2)      !  7.25  7  6.75  6.5  6.75  7  7.25  7.5

delay
---- output
7.25     7  6.75   6.5  6.75     7  7.25   7.5

==== x0272_complex_numbers_12268 | complex_numbers | tutorial.txt line 12268 | expected: none
z = 3 + 4i
print sqrt(z), exp(1i), log(z)             !  2+1i   0.5403023058681398+0.8414709848078965i   1.6094379124341+0.9272952180016122i
print sin(z), cos(1 + 1i), tanh(1 + 1i)   !  3.853738037919377-27.01681325800394i   0.8337300251311491-0.9888977057628651i   1.083923327338695+0.2717525853195117i
print asin(2 + 0i), atn(2i)               !  1.570796326794897+1.316957896924817i   1.570796326794897+0.5493061443340549i
print z ^ 0.5, (-8 + 0i) ^ (1 / 3), 2 ^ (1i)   !  2+1i   1+1.732050807568877i   0.7692389013639721+0.6389612763136348i
print sqrt(-4 + 0i), sqrt(conj(-4 + 0i))    !  0+2i   0-2i      -- the cut: from above, from below
print log(-1 + 0i), log(conj(-1 + 0i))    !  0+3.141592653589793i   0-3.141592653589793i
print exp(log(z)), sin(z) ^ 2 + cos(z) ^ 2   !  3+3.999999999999999i   0.9999999999998803+4.162852422011e-15i

delay
---- output
 2+1i  0.5403023058681398+0.8414709848078965i  1.6094379124341+0.9272952180016122i 
 3.853738037919377-27.01681325800394i  0.8337300251311491-0.9888977057628651i  1.083923327338695+0.2717525853195117i 
 1.570796326794897+1.316957896924817i  1.570796326794897+0.5493061443340549i 
 2+1i  1+1.732050807568877i  0.7692389013639721+0.6389612763136348i 
 0+2i  0-2i 
 0+3.141592653589793i  0-3.141592653589793i 
 3+3.999999999999999i  0.9999999999998803+4.162852422011e-15i

==== x0273_complex_numbers_12292 | complex_numbers | tutorial.txt line 12292 | expected: none
zc = 0 + 0i
when exception in
  y = log(zc)
use
  print extype; " "; extext$; " -- "; _string$   !  -4106  Numeric value out of range for this function -- log() of 0+0i: the result is not finite
end when
dim v(*)
fill v with 1 + 1i, -1 + 0i, 1i
print sqrt(v)   !  1.09868411346781+0.4550898605622273i   0+1i   0.7071067811865476+0.7071067811865475i

delay
---- output
-4106  Numeric value out of range for this function -- log() of 0+0i: the result is not finite
  1.09868411346781+0.4550898605622273i                                    0+1i  0.7071067811865476+0.7071067811865475i

==== x0274_data_files_12398 | data_files | tutorial.txt line 12398 | expected: none
my_name$ = "Sally"
my_age   = 22

print "Hello "; my_name$; ". I see that you are "; my_age; "."

delay
---- output
Hello Sally. I see that you are  22 .

==== x0281_data_files_12772 | data_files | tutorial.txt line 12772 | expected: none
textwindow://title of the textwindow?option1=value&option2=value2...

delay
---- output


==== x0283_data_files_12855 | data_files | tutorial.txt line 12855 | expected: none
textwindow://Status Window?noclose

delay
---- output


==== x0284_data_files_12863 | data_files | tutorial.txt line 12863 | expected: none
textwindow://Status Window?noclose=true

delay
---- output


==== x0307_data_files_13421 | data_files | tutorial.txt line 13421 | expected: none
// This will fail because the file does not exist
when exception in
  open file fake_ch: name "no_such_file.txt", access input
use
  print "Error: Could not find the file."
end when

delay
---- output
Error: Could not find the file.

==== x0317_data_files_13756 | data_files | tutorial.txt line 13756 | expected: none
open file data_ch: name 'data://'

for i = 1 to 10
  print #data_ch: i, sqrt(i)
next i

ask #data_ch: data mydata$
print mydata$

close #data_ch

delay
---- output
 1  1 
 2  1.414213562373095 
 3  1.7320508075688773 
 4  2 
 5  2.2360679774997897 
 6  2.4494897427831781 
 7  2.6457513110645906 
 8  2.8284271247461901 
 9  3 
 10  3.1622776601683793

==== x0331_tcp_udp_protocols_14477 | tcp_udp_protocols | tutorial.txt line 14477 | expected: none
// specify port 23
open file tcp_ch: name 'tcp://' + '?port=23', access outin

delay
---- output


==== x0333_tcp_udp_protocols_14509 | tcp_udp_protocols | tutorial.txt line 14509 | expected: none
// set timeout to 20 seconds
open file udp_ch: name 'udp://' + '?timeout=20', access outin

delay
---- output


==== x0341_clusters_15460 | clusters | tutorial.txt line 15460 | expected: none
cluster meals: protein$, liquid$, carb$
  meals->protein$ = "Eggs"
  meals->liquid$ = "Tea"
  meals->carb$ = "Toast"

  delay
---- output


==== x0342_clusters_15481 | clusters | tutorial.txt line 15481 | expected: none
cluster employee: name$, age, position$, real salary
employee->name$ = "John Doe"
employee->age = 30
employee->position$ = "Manager"
employee->salary = 70_000

delay
---- output


==== x0343_clusters_15504 | clusters | tutorial.txt line 15504 | expected: none
cluster mylist: age=35, weight=160, id$, salary

delay
---- output


==== x0344_clusters_15531 | clusters | tutorial.txt line 15531 | expected: none
cluster student: name$, age, grade$
add cluster student
  student->name$ = "Alice"
  student->age = 20
  student->grade$ = "A"
end add
add cluster student
  student->name$ = "Bob"
  student->age = 21
  student->grade$ = "B"
end add

delay
---- output


==== x0346_clusters_15579 | clusters | tutorial.txt line 15579 | expected: none
cluster meals: protein$, liquid$, carb$

cluster breakfast using meals
  breakfast->protein$ = "Eggs"
  breakfast->liquid$ = "Tea"
  breakfast->carb$ = "Toast"

cluster lunch using meals
  lunch->protein$ = "Chicken"
  lunch->liquid$ = "Coffee"
  lunch->carb$ = "Rice"

cluster dinner using meals
  dinner->protein$ = "Steak"
  dinner->liquid$ = "Wine"
  dinner->carb$ = "Rice"

  delay
---- output


==== x0347_clusters_15614 | clusters | tutorial.txt line 15614 | expected: none
cluster diet: protein$ = "Steak",
        liquid$  = "Wine",
        carb$    = "Rice",
        calories = 2000

        delay
---- output


==== x0348_cluster_arrays_15857 | cluster_arrays | tutorial.txt line 15857 | expected: none
! Define the structure for our inventory
cluster inventory: item_id$, product_name$, quantity, price

! Add the first record to the cluster array
add cluster inventory
  inventory->item_id$ = "WID-001"
  inventory->product_name$ = "Standard Widget"
  inventory->quantity = 150
  inventory->price = 19.99
end add

! Add a second record
add cluster inventory
  inventory->item_id$ = "GAD-002"
  inventory->product_name$ = "Super Gadget"
  inventory->quantity = 75
  inventory->price = 29.95
  end add

  delay
---- output


==== x0359_cluster_arrays_16051 | cluster_arrays | tutorial.txt line 16051 | expected: none
cluster word_counts: word$, times_seen
set word_counts->word$: create         // create missing word rows
sentence$ = "the cat and the dog and the bird"
for word_number = 1                    // open-ended: stop when the words run out
  word$ = getword$(sentence$, word_number)
  if word$ = "" then exit for
  word_counts->times_seen(word$) = word_counts->times_seen(word$) + 1   // its row is created
next word_number
print "distinct words: "; size(word_counts); &
   "  the = "; word_counts->times_seen("the"); &
   "  and = "; word_counts->times_seen("and")

   delay
---- output
distinct words:  5   the =  3   and =  2

==== x0364_cluster_arrays_16196 | cluster_arrays | tutorial.txt line 16196 | expected: DIFFERENT
cluster inventory: item$, price, quantity

! ... rows added ...

collect cluster inventory
  sort descending by inventory->price * inventory->quantity
end collect

for each inventory
  print inventory->item$; '  '; &
    sprintf$('%.2m', inventory->price * inventory->quantity)
next inventory

delay
---- output


==== x0366_cluster_arrays_16263 | cluster_arrays | tutorial.txt line 16263 | expected: same
cluster clients: nm$, home_zip$, bill_zip$

add cluster clients
  clients->nm$       = 'Baker'
  clients->home_zip$ = '98101'
  clients->bill_zip$ = '10001'
end add

add cluster clients
  clients->nm$       = 'Adams'
  clients->home_zip$ = ''
  clients->bill_zip$ = '30301'
end add

add cluster clients
  clients->nm$       = 'Chen'
  clients->home_zip$ = '02134'
  clients->bill_zip$ = '90210'
end add

add cluster clients
  clients->nm$       = 'Diaz'
  clients->home_zip$ = ''
  clients->bill_zip$ = '60601'
end add

collect cluster clients
  if clients->home_zip$ = '' then
    sort by clients->bill_zip$     ! no home zipcode -- fall back
  else
    sort by clients->home_zip$
  end if
end collect

for each clients
  print clients->nm$; ' home='; clients->home_zip$; ' bill='; clients->bill_zip$
next clients

delay
---- output
Chen home=02134 bill=90210
Adams home= bill=30301
Diaz home= bill=60601
Baker home=98101 bill=10001

==== x0367_cluster_arrays_16375 | cluster_arrays | tutorial.txt line 16375 | expected: DIFFERENT
cluster contacts: cname$, email$

! ... rows added: seven contacts, where baker@acme.com was
! entered three times and diaz@acme.com twice ...

collect cluster contacts: groupmin 2
  sort by contacts->email$
end collect

print 'duplicated email rows: '; _extracted
for each contacts
  print contacts->email$; '  '; contacts->cname$
next contacts

delay
---- output
duplicated email rows:  0

==== x0369_cluster_arrays_16508 | cluster_arrays | tutorial.txt line 16508 | expected: same
cluster log_entry: stamp$, event$

add cluster log_entry: stamp$ = '09:00', event$ = 'server started'
add cluster log_entry: stamp$ = '09:05', event$ = 'user alice logged in'
add cluster log_entry: stamp$ = '09:12', event$ = 'report printed'
add cluster log_entry: stamp$ = '09:30', event$ = 'user alice logged out'

collect cluster log_entry: reverse
end collect

for each log_entry
  print log_entry->stamp$; '  '; log_entry->event$
next log_entry

delay
---- output
09:30  user alice logged out
09:12  report printed
09:05  user alice logged in
09:00  server started

==== x0371_cluster_arrays_16599 | cluster_arrays | tutorial.txt line 16599 | expected: DIFFERENT
cluster listings: addr$, bedrooms, cornerlot$, garage, price, sqft

! ... rows added ...

budget = 350_000

collect cluster listings

  score = 0

  if listings->bedrooms >= 2      then score = score + 50
  if listings->cornerlot$ = 'y'   then score = score + 20
  if listings->garage >= 2        then score = score + 15
  if listings->price <= budget    then score = score + 40
  if listings->sqft >= 1_800      then score = score + 10

  include score >= 50

  sort descending by score

end collect

print 'matches: '; _extracted
for each listings
  print listings->addr$; '  '; listings->bedrooms; ' br  $'; listings->price
next listings

delay
---- output
matches:  0

==== x0379_Sheerpower_statistics_16985 | Sheerpower_statistics | tutorial.txt line 16985 | expected: none
dim scores(*)
fill scores with 72, 85, 90, 64, 58, 95, 78, 81

print 'mean       '; stats$mean(scores)
print 'median     '; stats$median(scores)
print 'highest    '; stats$max(scores); '   lowest '; stats$min(scores)
print 'spread     '; stats$stddev(scores)

delay
---- output
mean        77.875 
median      79.5 
highest     95    lowest  58 
spread      12.6653351430475098

==== x0385_Sheerpower_statistics_17045 | Sheerpower_statistics | tutorial.txt line 17045 | expected: none
dim names$(*)
fill names$ with 'apples', 'pears', 'blueberrys', 'oranges'
print 'Longest name len: '; names$ |> len() |> stats$max()
dim by_len$(*)
by_len$ = names$[sortindex(len(names$), descending: true)]
print 'Longest name:     '; by_len$(1)
print 'mean length:      '; names$ |> len() |> stats$mean()
print 'shortest:         '; filter(names$, len(names$) = stats$min(len(names$)))

delay
---- output
Longest name len:  10 
Longest name:     blueberrys
mean length:       7 
shortest:         pears

==== x0387_Sheerpower_statistics_17067 | Sheerpower_statistics | tutorial.txt line 17067 | expected: none
dim dice(*)
set seed 42
fill dice with 1000 of rnd(6)
print 'mean of 1000 rolls '; stats$mean(dice)
print 'sixes              '; stats$sum(dice = 6)
print 'mode               '; stats$mode(dice)

delay
---- output
mean of 1000 rolls  3.55 
sixes               178 
mode                4

==== x0389_Sheerpower_statistics_17089 | Sheerpower_statistics | tutorial.txt line 17089 | expected: none
dim grid(3, 4)
fill grid with seq(1, 12)
print 'sum of all cells   '; stats$sum(grid)
print 'mean of all cells  '; stats$mean(grid)

delay
---- output
sum of all cells    78 
mean of all cells   6.5

==== x0391_Sheerpower_statistics_17104 | Sheerpower_statistics | tutorial.txt line 17104 | expected: none
dim none(*)
when exception in
  m = stats$mean(none)
use
  print 'empty array: '; extext$
end when

delay
---- output
empty array: No statistic exists for this data

==== x0395_searching_cluster_data_18742 | searching_cluster_data | tutorial.txt line 18742 | expected: none
cluster trans: english$, german$

delay
---- output


==== x0412_cluster_as_a_dictionary_19532 | cluster_as_a_dictionary | tutorial.txt line 19532 | expected: none
// An example of using a cluster as a simple Key/Value pair Data Dictionary
// Note:  All cluster variables can be used as keys

cluster capitals: country$, city$

add cluster capitals
  capitals->country$ = 'USA'
  capitals->city$    = 'Washington, D.C.'
end add
add cluster capitals: capitals->country$ = 'Germany',
            capitals->city$    = 'Berlin'
          
add cluster capitals: capitals->country$ = 'China', 
            capitals->city$    = 'Beijing'

row = findrow(capitals->country$, 'Germany')
if row = 0 then
  print 'Unknown'
else
  print capitals->city$
end if

row = findrow(capitals->city$, 'Beijing')
if row = 0 then
  print 'Unknown'
else
  print capitals->country$
end if

delay
---- output
Berlin
China

==== x0413_cluster_spreadsheets_19678 | cluster_spreadsheets | tutorial.txt line 19678 | expected: none
cluster cities: City$, Country$, Population, Region$, Latitude, Longitude

cluster input name '@..\safe\safe_world_cities.csv', headers 1: cities
print 'cities input: '; size(cities)

delay
---- output
cities input:  9268

==== x0436_embed_cluster_20603 | embed_cluster | tutorial.txt line 20603 | expected: none
cluster address: addr1$, addr2$, city$, state$, zip$   // cluster template 
cluster client: client_id$, client_name$, cluster address  
cluster user: login$, name$, cluster address, age 
cluster company: company_name$, cluster address 
client->city$ = 'San Diego'

delay
---- output


==== x0437_embed_cluster_20614 | embed_cluster | tutorial.txt line 20614 | expected: none
  cluster address:  addr1$, addr2$, city$, state$, zip$ 
  cluster fullname: first$, last$   
  cluster multi: ssn$, prefix cluster address, tax, is_okay?

  add cluster multi
    multi->ssn$         = '222-33-4444'
    multi->address->city$ = 'Duluth'
    multi->address->state$  = 'MN'
    multi->tax          = 45.678
    multi->is_okay?     = false 
  end add

  delay
---- output


==== x0439_embed_cluster_20642 | embed_cluster | tutorial.txt line 20642 | expected: none
  cluster fullname: first$, last$   
 cluster multi: ssn$, prefix cluster fullname, tax, is_okay?  
  
 add cluster multi   
   multi->ssn$     = '222-33-4444'   
   multi->fullname->first$   = 'Mister2 "they say"'   
   multi->fullname->last$    = 'Smith2'   
   multi->tax      = 45.678   
   multi->is_okay? = false   
 end add

 delay
---- output


==== x0442_enum_20862 | enum | tutorial.txt line 20862 | expected: none
enum traffic_light: red, yellow, green

current_state = traffic_light->yellow

select case current_state
case traffic_light->red
   print "Stop"

case traffic_light->yellow
   print "Get Ready"

case traffic_light->green
   print "Go"

case else
   print "Unknown State"
end select

! Print the number of members in the enum
print "Number of members: "; size(traffic_light, 2)

delay
---- output
Get Ready
Number of members:  3

==== x0443_enum_20922 | enum | tutorial.txt line 20922 | expected: none
enum status: pending=10, approved=20, rejected=30, expired=40

delay
---- output


==== x0444_enum_20931 | enum | tutorial.txt line 20931 | expected: none
enum response: unknown=0, accepted=10, delayed, rejected=20

! unknown  = 0
! accepted = 10
! delayed  = 11
! rejected = 20

delay
---- output


==== x0445_enum_20957 | enum | tutorial.txt line 20957 | expected: none
enum order_status: pending, paid, shipped, delivered, cancelled

delay
---- output


==== x0447_enum_20994 | enum | tutorial.txt line 20994 | expected: none
enum status: pending, approved, rejected, expired

current = status->approved

print "Status: "; enumname$(status, current)
! Outputs: APPROVED

print "Status: "; enumname$(status, 999)
! Outputs: ?999?

print "_integer after failure: "; _integer
! Outputs: 0

delay
---- output
Status: APPROVED
Status: ?999?
_integer after failure:  0

==== x0448_enum_21022 | enum | tutorial.txt line 21022 | expected: none
enum status: pending, approved, rejected

current = status->rejected

print "Status: "; enumname$(status, current)

delay
---- output
Status: REJECTED

==== x0451_enum_21122 | enum | tutorial.txt line 21122 | expected: none
enum mode: off=0, slow=10, fast=20

! Member   Assigned value   Ordinal
! off             0            1
! slow           10            2
! fast           20            3

delay
---- output


==== x0453_enum_21171 | enum | tutorial.txt line 21171 | expected: none
enum mode: off=0, slow=1, fast=2

value = enumvalue(mode, "off")
! value = 0
! _integer = 1

value = enumvalue(mode, "bogus")
! value = 0
! _integer = 0

delay
---- output


==== x0455_enum_21242 | enum | tutorial.txt line 21242 | expected: none
enum log_level: debug=10, info=20, warn=30, error=40

level$ = getsymbol$("level")
level = enumvalue(log_level, trim$(level$))

if _integer = 0 then
   print "Error: unknown log level '"; level$; "'"
else
   print "Logging at "; level$; " ("; level; ")"
end if

delay
---- output
Error: unknown log level ''

==== x0456_enum_21263 | enum | tutorial.txt line 21263 | expected: none
enum status: active=10, inactive=20, archived=30

saved$ = enumname$(status, status->active)
! saved$ = "ACTIVE"

! Later, after saved$ has been read from storage:

code = enumvalue(status, saved$)
! code = 10
! _integer = 1

delay
---- output


==== x0457_enum_21284 | enum | tutorial.txt line 21284 | expected: none
enum sort_dir: ascending, descending

dir$ = getsymbol$("sort")
dir = enumvalue(sort_dir, trim$(dir$))

if _integer = 0 then
   dir = sort_dir->ascending
end if

delay
---- output


==== x0459_enum_21328 | enum | tutorial.txt line 21328 | expected: none
enum planet: mercury=100, venus=200, earth=300, mars=400

dim distance_au$(4)

distance_au$(1) = "0.39"
distance_au$(2) = "0.72"
distance_au$(3) = "1.00"
distance_au$(4) = "1.52"

name$ = "earth"
value = enumvalue(planet, name$)
ordinal = _integer

if ordinal > 0 then
   print distance_au$(ordinal)
end if

delay
---- output
1.00

==== x0460_strings_21667 | strings | tutorial.txt line 21667 | expected: none
fullname$ = 'Sally Sue'
sentence$ = fullname$ + ' was here.'
print sentence$
sentence$ = 'So I heard.'
print sentence$

sentence$ = ''
l = join(sentence$, fullname$, ' was here')
print sentence$

delay
---- output
Sally Sue was here.
So I heard.
Sally Sue was here

==== x0462_strings_21934 | strings | tutorial.txt line 21934 | expected: none
x$ = "12345"

// Left-justify and pad with spaces
LSET x$ = "abc"
// x$ is now: "abc  "

// Center within the field
CSET x$ = "abc"
// x$ is now: " abc "

// Right-justify and pad with spaces
RSET x$ = "abc"
// x$ is now: "  abc"

delay
---- output


==== x0463_strings_21955 | strings | tutorial.txt line 21955 | expected: none
x$ = "12345"
LSET x$ = "TOO-LONG"
// x$ becomes: "TOO-L"

delay
---- output


==== x0464_strings_21995 | strings | tutorial.txt line 21995 | expected: none
x$ = "12345"
x$ = "abc"
// x$ becomes "abc"

delay
---- output


==== x0465_strings_22006 | strings | tutorial.txt line 22006 | expected: none
x$ = "12345"
LSET x$ = "abc"
// x$ becomes "abc  "

delay
---- output


==== x0466_strings_22019 | strings | tutorial.txt line 22019 | expected: none
x$ = %text
   some text
     more text
// even lines that look like comments
%end text

print x$

delay
---- output
   some text
     more text
// even lines that look like comments

==== x0468_strings_22099 | strings | tutorial.txt line 22099 | expected: none
dim names$(*), first$(*), last$(*)
fill first$ with "Ann", "Ben", "Cal"
fill last$ with "Lee", "Moe", "Dee"
names$ = first$ + " " + last$              ! + pairs the two arrays element by element
print names$                                ! Ann Lee  Ben Moe  Cal Dee
print ucase$(names$)                        ! ANN LEE  BEN MOE  CAL DEE   -- every string function maps
print len(names$)                           ! 7  7  7
print names$ = "Ben Moe"                    ! 0  1  0                     -- a comparison is a mask
print filter(names$, same(last$, "dee"))    ! Cal Dee                     -- case-blind, through same()
print join$(sort(names$), " | ")            ! Ann Lee | Ben Moe | Cal Dee
print size(unique(last$))                   ! 3                           -- how many different surnames

delay
---- output
Ann Lee  Ben Moe  Cal Dee
ANN LEE  BEN MOE  CAL DEE
7  7  7
0  1  0
Cal Dee
Ann Lee | Ben Moe | Cal Dee
 3

==== x0471_string_functions_22335 | string_functions | tutorial.txt line 22335 | expected: none
mybuf$ = space$(1024)
subtext$ = 'abcde'
start_pos = 1
for idx = 1 to 5
  start_pos = overlay(mybuf$, subtext$, start_pos)
next idx

delay
---- output


==== x0472_string_functions_22350 | string_functions | tutorial.txt line 22350 | expected: none
numbers$ = ''
for i = 1 to 100_0000
  newlen = join(numbers$, str$(i), ' ')
next i
print 'Length: '; len(numbers$)
print 'Elapsed: '; _elapsed

delay
---- output
Length:  6888896 
Elapsed:  0.406

==== x0473_string_functions_22367 | string_functions | tutorial.txt line 22367 | expected: none
s$ = 'abcdefgh'
print s$[2:4]                     ! bcd
print s$[6:20]                    ! fgh -- a range past the end is short
t$ = 'abcdefgh'
t$[3:4] = 'XY'
print t$                          ! abXYefgh

delay
---- output
bcd
fgh
abXYefgh

==== x0474_string_functions_22382 | string_functions | tutorial.txt line 22382 | expected: none
s$ = 'abcdefgh'
print s$[5:*]                     ! efgh -- from 5 to the end
print s$[*-2:*]                   ! fgh -- the last three
print s$[:3]                      ! abc -- the first three
print s$[1:*:2]                   ! aceg -- every other character
print s$[*:1:-1]                  ! hgfedcba -- reversed

word$ = 'racecar'
if word$ = word$[*:1:-1] then print word$; ' reads the same both ways'

delay
---- output
efgh
fgh
abc
aceg
hgfedcba
racecar reads the same both ways

==== x0476_string_functions_22708 | string_functions | tutorial.txt line 22708 | expected: none
data$ = "phone=(702) 555-1212 age=42"
VIEW area$ INTO data$ BETWEEN "(", ")"
VIEW age$ INTO data$ BETWEEN "age=", ""

print area$       // Output: 702
print age$        // Output: 42

// Replace the entire base string
data$ = "My new phone number is (858) 555-1212"

// The view updates automatically
print area$       // Output: 858
print age$        // Output: (empty string)

// Overlay through the view modifies the source
lset area$ = "211"
print data$       // Output: My new phone number is (211) 555-1212

// Using MATCH to get a specific occurrence
data$ = "phone=(702) 555-(1212) age=42"
VIEW area2$ INTO data$ BETWEEN "(", ")" MATCH 2
print area2$      // Output: 1212

data$ = "phone=555-1212 age=42"  // Missing parens
print area2$  // Output: (empty string)

// All VIEW parameters accept runtime expressions
list$ = "[apple][banana][cherry]"
for occurrence = 1 to 10
  VIEW item$ INTO list$ BETWEEN "[", "]" MATCH occurrence
  if item$ = "" then exit for  // No more items
  print item$
next occurrence
// Output (one per line):
//   apple
//   banana  
//   cherry

// Automatic zero-copy parsing into cluster fields upon reference
cluster info: name$, age$, weight$

view info->name$   into data$ between "name="  , ";"
view info->age$    into data$ between "age="   , ";"
view info->weight$ into data$ between "weight=", ";"
 
data$ = 'name=Fred; age=45; weight=160;'
print cluster info // outputs all field values in the cluster called info.

data$ = 'weight=120; age=25; name=Sally; '
print cluster info

// outputs:
//  "Fred","45","160"
//  "Sally","25","120"

delay
---- output
702
42
858

My new phone number is (211) 555-1212
1212

apple
banana
cherry
"Fred","45","160"
"Sally","25","120"

==== x0477_string_functions_22773 | string_functions | tutorial.txt line 22773 | expected: none
// Base string with padded value
data$ = "value=[   123   ] status=ok"

// Default: trims spaces between delimiters
VIEW num$      INTO data$ BETWEEN "[", "]"

// NOTRIM: keeps the exact characters between delimiters
VIEW num_raw$  INTO data$ BETWEEN "[", "]" NOTRIM

print "[" + num$     + "]"   // Output: [123]
print "[" + num_raw$ + "]"   // Output: [   123   ]

delay
---- output
[123]
[   123   ]

==== x0478_string_functions_22792 | string_functions | tutorial.txt line 22792 | expected: none
data$ = "outer[start [inner] tail] end"

// Without BALANCED: first "[" to first "]" after it
VIEW inner$ INTO data$ BETWEEN "[", "]"

// With BALANCED: first "[" to its matching outer "]"
VIEW outer$ INTO data$ BETWEEN "[", "]" BALANCED

print inner$   // Output: start [inner
print outer$   // Output: start [inner] tail

delay
---- output
start [inner
start [inner] tail

==== x0479_string_functions_22896 | string_functions | tutorial.txt line 22896 | expected: none
    text$ = chr$(5) + "hi" + chr$(9)
    print "["; change$(text$, charset$("control")); "]"

    delay
---- output
[hi]

==== x0480_string_functions_22902 | string_functions | tutorial.txt line 22902 | expected: none
    print charset$("ucase")

    delay
---- output
ABCDEFGHIJKLMNOPQRSTUVWXYZ

==== x0481_string_functions_23092 | string_functions | tutorial.txt line 23092 | expected: same
// 'A' (0x41), 'B' (0x42)
print convert('AB')    // Default (Little-endian): 0x4241

print convert('AB', 4) // Big-endian: 0x4142

delay
---- output
 16961 
 16706

==== x0482_string_functions_23492 | string_functions | tutorial.txt line 23492 | expected: none
  q$='?action=run&format=myformat&filter1=coach(id)=78768'
  set querystring q$
  print getsymbol$('filter1')  // outputs coach(id)=78768

  delay
---- output
coach(id)=78768

==== x0484_string_functions_24283 | string_functions | tutorial.txt line 24283 | expected: none
phone$ = "8085551212"

// Create a view into the first 3 characters
VIEW area$ INTO phone$, MID 1, 3

print area$      // Output: 808

// Modify the source string
phone$ = "7022229999"

// area$ updates automatically
print area$      // Output: 702

// Overwriting a view updates the source
lset area$ = "abc"
print phone$     // Output: abc2229999

phone$ = ""
print area$     // Output: (empty string), since phone$ now has zero length.

delay
---- output
808
702
abc2229999

==== x0485_string_functions_24315 | string_functions | tutorial.txt line 24315 | expected: none
cluster parts: area$, exch$

view parts->area$ into phone$, mid 1, 3
view parts->exch$ into phone$, mid 5, 3

phone$ = "702-997-1212"
print cluster parts     // Outputs: "702","997"

phone$ = "213-555-1212"
print cluster parts     // Outputs: "213","555"

delay
---- output
"702","997"
"213","555"

==== x0487_string_functions_24723 | string_functions | tutorial.txt line 24723 | expected: none
t$ = "Total: [[total]] on [[date]]"
print replace$(t$, "[[total]]=$1,234.56|[[date]]=June 25, 2026", '|')
// output:  Total: $1,234.56 on June 25, 2026

delay
---- output
Total: $1,234.56 on June 25, 2026

==== x0488_string_functions_25036 | string_functions | tutorial.txt line 25036 | expected: none
    a$ = 'hi'
    print typeof$(a$)
    // Output: Name:A$, Dtype:String

    age = 56
    print typeof$(age)
    // Output: Name:AGE, Dtype:Real, *Narrow*

    third = 1 / 3
    print typeof$(third)
    // Output: Name:THIRD, Dtype:Real, *Narrow*, *Rounded*

    type real feet
    declare feet mysize
    mysize = 6
    print typeof$(mysize)
    // Output: Name:MYSIZE, Dtype:Real, Ctype:FEET, *Narrow*

    type nodump string secret 
    declare secret password
    password = 'xxxyyy'
    print typeof$(password)
    // Output: Name:PASSWORD, Dtype:String, Ctype:SECRET, *Nodump*

    dim flags?(*)
    fill flags? with 1, 0, 1
    print typeof$(flags?)
    // Output: Name:FLAGS?, Dtype:Boolean, *Array*, Dims:1, Bounds:1:3, Size:3, *Expandable*, *Packed*

    delay
---- output
Name:A$, Dtype:String
Name:AGE, Dtype:Real, *Narrow*
Name:THIRD, Dtype:Real, *Narrow*, *Rounded*
Name:MYSIZE, Dtype:Real, Ctype:FEET, *Narrow*
Name:PASSWORD, Dtype:String, Ctype:SECRET, *Nodump*
Name:FLAGS?, Dtype:Boolean, *Array*, Dims:1, Bounds:1:3, Size:3, *Expandable*, *Packed*

==== x0489_string_functions_25073 | string_functions | tutorial.txt line 25073 | expected: none
    routine convert_to_fahrenheit with temperature, returning result

        if pos(typeof$(temperature), "Ctype:CELSIUS") > 0 then
          result = (temperature * 9 / 5) + 32
        else
          result = temperature  // Assume input is already in Fahrenheit
        end if
 
    end routine

   type real celsius
   declare celsius temperature
   temperature = 100

   convert_to_fahrenheit with temperature, returning result
   print 'Result in fahrenheit: '; result
---- output
Result in fahrenheit:  212

==== x0490_string_functions_25310 | string_functions | tutorial.txt line 25310 | expected: DIFFERENT
  print _gid$

  delay
---- output
20261016Q6b39EFHNk6kCTCjAIeY9g

==== x0491_string_functions_25397 | string_functions | tutorial.txt line 25397 | expected: none
  print "Entering routine: " + _ROUTINE$

  delay
---- output
Entering routine: MAIN

==== x0492_string_views_25621 | string_views | tutorial.txt line 25621 | expected: none
   data$ = "hello"
   VIEW v$ INTO data$, MID 2, 3
   // v$ hasn't calculated positions yet
   PRINT v$  // NOW it evaluates to "ell" (and caches it)
   PRINT v$  // Reuses cached positions - no recalculation!
   data$ = "world"
   PRINT v$  // Re-evaluates to "orl" because source changed

   delay
---- output
ell
ell
orl

==== x0493_string_views_25665 | string_views | tutorial.txt line 25665 | expected: none
data$ = "[alpha,beta,gamma]"

// First view isolates the bracketed region
view list$ into data$ between "[", "]"

// Second view refines the first view
view second$ into list$ piece ",", match 2

print second$   // beta

delay
---- output
beta

==== x0495_string_views_25699 | string_views | tutorial.txt line 25699 | expected: none
data$ = "[alpha,beta,gamma]"
print second$   // beta
lset second$ = "BETA"
print data$   // [alpha,BETA,gamma]

delay
---- output

[alpha,beta,gamma]

==== x0497_string_views_26038 | string_views | tutorial.txt line 26038 | expected: none
phone$ = "8085551212"

// Create a view into the first 3 characters
VIEW area$ INTO phone$,
     MID 1,3

PRINT area$      // Output: 808

// Create a view into the last 3 characters
VIEW area$ INTO phone$,
     MID -3,3

PRINT area$      // Output: 212

// Modify the source string
phone$ = "7022229999"

// area$ updates automatically
PRINT area$      // Output: 999

// Overwriting a view updates the source
LSET area$ = "abc"
PRINT phone$     // Output: abc2229999

phone$ = ""
PRINT area$      // Output: (empty string)

delay
---- output
808
212
999
7022229abc

==== x0499_string_views_26134 | string_views | tutorial.txt line 26134 | expected: none
cluster parts: area$, exch$

VIEW parts->area$ INTO phone$,
     MID 1,3

VIEW parts->exch$ INTO phone$,
     MID 5,3

phone$ = "702-997-1212"
PRINT cluster parts   // Outputs: 702, 997

phone$ = "213-555-1212"
PRINT cluster parts   // Outputs: 213, 555

delay
---- output
"702","997"
"213","555"

==== x0501_string_views_26315 | string_views | tutorial.txt line 26315 | expected: none
data$ = "phone=(702) 555-1212 age=42"

VIEW area$ INTO data$,
     BETWEEN "(", ")"

VIEW age$ INTO data$,
     BETWEEN "age=", ""

PRINT area$       // Output: 702
PRINT age$        // Output: 42

// Replace the entire base string
data$ = "My new phone number is (858) 555-1212"

// The view updates automatically
PRINT area$       // Output: 858
PRINT age$        // Output: (empty string)

// Overlay through the view modifies the source
LSET area$ = "211"
PRINT data$
  // Output: My new phone number is (211) 555-1212

// Using MATCH to get a specific occurrence
data$ = "phone=(702) 555-(1212) age=42"

VIEW area2$ INTO data$,
     BETWEEN "(", ")" MATCH 2

PRINT area2$      // Output: 1212

data$ = "phone=555-1212 age=42"  // Missing parens
PRINT area2$      // Output: (empty string)

// All VIEW parameters accept runtime expressions
list$ = "[apple][banana][cherry]"

FOR occurrence = 1 TO 10
  VIEW item$ INTO list$,
       BETWEEN "[", "]" MATCH occurrence

  IF item$ = "" THEN EXIT FOR  // No more items
  PRINT item$
NEXT occurrence
// Output (one per line):
//   apple
//   banana
//   cherry

delay
---- output
702
42
858

My new phone number is (211) 555-1212
1212

apple
banana
cherry

==== x0502_string_views_26370 | string_views | tutorial.txt line 26370 | expected: none
// Base string with padded value
data$ = "value=[   123   ] status=ok"

// Default: trims spaces between delimiters
VIEW num$ INTO data$,
     BETWEEN "[", "]"

// NOTRIM: keeps the exact characters between delimiters
VIEW num_raw$ INTO data$,
     BETWEEN "[", "]" NOTRIM

PRINT "[" + num$     + "]"   // Output: [123]
PRINT "[" + num_raw$ + "]"   // Output: [   123   ]

delay
---- output
[123]
[   123   ]

==== x0503_string_views_26388 | string_views | tutorial.txt line 26388 | expected: none
data$ = "outer[start [inner] tail] end"

// Without BALANCED: first "[" to first "]" after it
VIEW inner$ INTO data$,
     BETWEEN "[", "]"

// With BALANCED: first "[" to its matching outer "]"
VIEW outer$ INTO data$,
     BETWEEN "[", "]" BALANCED

PRINT inner$   // Output: start [inner
PRINT outer$   // Output: start [inner] tail

delay
---- output
start [inner
start [inner] tail

==== x0505_string_views_26486 | string_views | tutorial.txt line 26486 | expected: none
data$ = "one,two,three"

VIEW first$  INTO data$,
     PIECE ",", MATCH 1

VIEW second$ INTO data$,
     PIECE ",", MATCH 2

VIEW third$  INTO data$,
     PIECE ",", MATCH 3

PRINT first$   // Output: one
PRINT second$  // Output: two
PRINT third$   // Output: three

// Out-of-range match yields empty string
VIEW extra$ INTO data$,
     PIECE ",", MATCH 4

PRINT "[" + extra$ + "]"   // Output: []

delay
---- output
one
two
three
[]

==== x0506_string_views_26511 | string_views | tutorial.txt line 26511 | expected: none
data$ = ",a,,b,"

VIEW p1$ INTO data$,
     PIECE ",", MATCH 1   // Leading empty

VIEW p2$ INTO data$,
     PIECE ",", MATCH 2   // "a"

VIEW p3$ INTO data$,
     PIECE ",", MATCH 3   // Empty (two commas)

VIEW p4$ INTO data$,
     PIECE ",", MATCH 4   // "b"

VIEW p5$ INTO data$,
     PIECE ",", MATCH 5   // Trailing empty

PRINT "[" + p1$ + "]"  // []
PRINT "[" + p2$ + "]"  // [a]
PRINT "[" + p3$ + "]"  // []
PRINT "[" + p4$ + "]"  // [b]
PRINT "[" + p5$ + "]"  // []

delay
---- output
[]
[a]
[]
[b]
[]

==== x0507_string_views_26538 | string_views | tutorial.txt line 26538 | expected: none
data$  = "alpha||beta||gamma"
delim$ = "||"

VIEW a$ INTO data$,
     PIECE delim$, MATCH 1

VIEW b$ INTO data$,
     PIECE delim$, MATCH 2

VIEW c$ INTO data$,
     PIECE delim$, MATCH 3

PRINT a$  // alpha
PRINT b$  // beta
PRINT c$  // gamma

delay
---- output
alpha
beta
gamma

==== x0508_string_views_26558 | string_views | tutorial.txt line 26558 | expected: none
data$ = "one,two,three,four"

// Position 5 is inside "two"
VIEW mid1$ INTO data$,
     PIECE ",", POSITION 5

// From the same starting position,
// MATCH 2 is "three"
VIEW mid2$ INTO data$,
     PIECE ",", POSITION 5, MATCH 2

PRINT mid1$   // two
PRINT mid2$   // three

// POSITION beyond the end yields empty piece
VIEW off$ INTO data$,
     PIECE ",", POSITION 999, MATCH 1

PRINT "[" + off$ + "]"   // []

delay
---- output
two
three
[]

==== x0509_string_views_26582 | string_views | tutorial.txt line 26582 | expected: none
data$ = "one,two,three"

VIEW second$ INTO data$,
     PIECE ",", MATCH 2

LSET second$ = "TWO"
PRINT data$      // one,TWO,three

VIEW first$ INTO data$,
     PIECE ",", MATCH 1

VIEW third$ INTO data$,
     PIECE ",", MATCH 3

LSET first$ = "ONE"
LSET third$ = "THREE"

PRINT data$      // ONE,TWO,THREE

delay
---- output
one,TWO,three
ONE,TWO,THREE

==== x0510_string_views_26605 | string_views | tutorial.txt line 26605 | expected: none
cluster csv: col1$, col2$, col3$

VIEW csv->col1$ INTO line$,
     PIECE ",", MATCH 1

VIEW csv->col2$ INTO line$,
     PIECE ",", MATCH 2

VIEW csv->col3$ INTO line$,
     PIECE ",", MATCH 3

line$ = "apple,10,1.99"
PRINT cluster csv
  // "apple","10","1.99"

line$ = "banana,25,0.79"
PRINT cluster csv
  // "banana","25","0.79"

  delay
---- output
"apple","10","1.99"
"banana","25","0.79"

==== x0512_string_searching_26952 | string_searching | tutorial.txt line 26952 | expected: none
    filespec$ = "report_final.TXT"
    if contains(filespec$, "final") then print "This is a text file"
    if contains(filespec$, "FINAL", TRUE) then print "Exact case match"

    delay
---- output
This is a text file

==== x0513_string_searching_26995 | string_searching | tutorial.txt line 26995 | expected: none
    filespec$ = "report_final.TXT"
    if endswith(filespec$, ".txt") then print "This is a text file"
    if endswith(filespec$, ".TXT", TRUE) then print "Exact case match"

    delay
---- output
This is a text file
Exact case match

==== x0514_string_searching_27118 | string_searching | tutorial.txt line 27118 | expected: none
      if pattern('The quick brown fox', 'f?x') > 0 then
          print 'Found'
      end if

      delay
---- output
Found

==== x0515_string_searching_27129 | string_searching | tutorial.txt line 27129 | expected: none
      if pattern('aaa   01/26/99', 'a* *01/26/99') > 0 then
          print 'The date is found'
      end if

      delay
---- output
The date is found

==== x0516_string_searching_27140 | string_searching | tutorial.txt line 27140 | expected: none
      text$ = 'A1N5V7N0'
      rule_str$ = '{A-Z}{0-9}{A-Z}{0-9}{A-Z}{0-9}{A-Z}{0-9}'
      if pattern(text$, rule_str$) > 0 then
          print "Driver's license is correct."
      end if

      delay
---- output
Driver's license is correct.

==== x0517_string_searching_27153 | string_searching | tutorial.txt line 27153 | expected: none
      print pattern('Mary J. Smith', '{^Mar}')
      print pattern('Mary J. Smith', 'J. {^S}')
      print pattern('Mary J. Smith', 'J. S?')

      delay
---- output
 4 
 0 
 6

==== x0518_string_searching_27167 | string_searching | tutorial.txt line 27167 | expected: none
      text$ = '$4,670.00'
      if pattern(text$, '$~4,670.00') > 0 then
          print 'Your text is correct.'
      end if

      delay
---- output
Your text is correct.

==== x0519_string_searching_27179 | string_searching | tutorial.txt line 27179 | expected: none
      text$ = 'Help yourself to some ' + chr$(13) + 'food'
      if pattern(text$, '{|13|}') > 0 then
          print 'Carriage return found.'
      end if

      delay
---- output
Carriage return found.

==== x0520_string_searching_27191 | string_searching | tutorial.txt line 27191 | expected: none
      text$ = 'The area code is 619'
      if pattern(text$, 'is {<619|714|916>}') > 0 then
          print 'Your area code is on the list.'
      end if

      delay
---- output
Your area code is on the list.

==== x0521_string_searching_27202 | string_searching | tutorial.txt line 27202 | expected: none
      a$ = 'There are dogs and cats in the house.'
      b$ = 'Everyone would like to make big$bucks!'
      if pattern(a$, '{(cats)}') > 0 then
          print 'The word was found.'
      end if
      if pattern(b$, '{(big$bucks)}') > 0 then
          print 'The $ word was found.'
      end if

      delay
---- output
The word was found.
The $ word was found.

==== x0522_string_searching_27220 | string_searching | tutorial.txt line 27220 | expected: none
      a$ = 'ElEpHaNtS have trunks'
      b$ = 'water goes splash'
      if pattern(a$, '{|bol|}{|nocase|}elephants') > 0 then
          print 'elephants was found.'
      end if
      if pattern(b$, 'splash{|eol|}') > 0 then
          print 'splash was found.'
      end if

      delay
---- output
elephants was found.
splash was found.

==== x0523_string_searching_27291 | string_searching | tutorial.txt line 27291 | expected: none
  filename$ = "Report_Final.txt"
  if same(filename$, "  report_final.TXT ") then 
    print "They are the same!"
end if

if not same(filename$, "  report_final.TXT ", true) then
   print "They are NOT the same!"
end if

delay
---- output
They are the same!
They are NOT the same!

==== x0525_file_information_27450 | file_information | tutorial.txt line 27450 | expected: DIFFERENT
    print fileinfo$('x.y', 'ALL') 
    print fileinfo$('', 'ALL') 
    print fileinfo$('@config.ini', 'ALL')  // Relative to program directory

    delay

    end
---- output
C:\myprograms\x.y
C:\myprograms
C:\myprograms\config.ini

==== x0526_file_information_27467 | file_information | tutorial.txt line 27467 | expected: DIFFERENT
    x$ = 'Sheerpower:samples\client' 
    print fileinfo$(x$, 'ALL', '.ars') 

    delay
    end
---- output
c:\sheerpower\samples\client.ars

==== x0527_file_information_27480 | file_information | tutorial.txt line 27480 | expected: DIFFERENT
    print fileinfo$('Sheerpower:samples\client', 'all', '.ars') 
    print fileinfo$('Sheerpower:samples\client', 'location') 
    print fileinfo$('Sheerpower:samples\client', 'location, name') 
    print fileinfo$('Sheerpower:samples\client.ars') 

    delay
    end
---- output
c:\sheerpower\samples\client.ars
c:\sheerpower\samples\
c:\sheerpower\samples\client
c:\sheerpower\samples\client.ars

==== x0529_file_information_27512 | file_information | tutorial.txt line 27512 | expected: DIFFERENT
    all_of_file$ = fileinfo$('Sheerpower:Sheerpower.ini', 'contents') 
    print all_of_file$ 

    delay

    end
---- output
[license]
LicenseKey=xxx-xxx-xxx-xxx
Username=unlimited-use
EmailAddress=unlimited-use

==== x0533_file_information_27627 | file_information | tutorial.txt line 27627 | expected: DIFFERENT
print findfile$('sheerpower:\samples\*.spsrc')

delay
---- output
c:\sheerpower\samples\add_to_dict.spsrc

==== x0536_file_information_27685 | file_information | tutorial.txt line 27685 | expected: none
// Tell the length of each file by reading its contents

my_path$ = 'c:\sheerpower\*.*'

for idx = 1 to 19999
  my_file$ = findfile$(my_path$, idx)
  if my_file$ = '' then exit for

  contents$ = fileinfo$(my_file$, 'contents')
  print my_file$; ', length '; len(contents$)
next idx

delay

end
---- output
(output left out of the plugin: it listed the files in the Sheerpower folder of the machine that ran it)

==== x0537_file_information_27708 | file_information | tutorial.txt line 27708 | expected: none
// Example concept (inner call returns a file name)

result$ = findfile$(findfile$('c:\data\*.txt'))

delay
---- output


==== x0539_regular_expressions_27779 | regular_expressions | tutorial.txt line 27779 | expected: none
text$ = 'it is raining outside'
expr$ = 'rain'
starting = regexsearch(text$, expr$)
print mid(text$, starting, _integer)

delay
---- output
rain

==== x0540_regular_expressions_27789 | regular_expressions | tutorial.txt line 27789 | expected: none
text$ = '505-555-1212'
expr$ = '(\d{3})-(\d{3})-(\d{4})'
for idx = 0 to 999
  starting = regexsearch(text$, expr$,idx)
  if starting = 0 then exit for
  print idx, mid(text$, starting, _integer)
next idx

delay
---- output
 0 505-555-1212
 1 505
 2 555
 3 1212

==== x0541_regular_expressions_27801 | regular_expressions | tutorial.txt line 27801 | expected: none
text$ = 'it is raining outside'
expr$ = 'rain'
print regexreplace$(text$, expr$, 'snow')

delay
---- output
it is snowing outside

==== x0542_regular_expressions_27810 | regular_expressions | tutorial.txt line 27810 | expected: none
text$ = 'I am 39 years old'
expr$ = '(\d+)'
starting = regexsearch(text$, expr$, 1)

print 'The age is '; mid(text$, starting, _integer)
text$[starting:starting+_integer-1] = '65' // change the age to 65
print text$

delay
---- output
The age is 39
I am 65 years old

==== x0543_sprintf_27871 | sprintf | tutorial.txt line 27871 | expected: none
name$ = 'Sally'
age = 26

print 'Hello '; name$; '. You are '; age; ' years old'

delay
---- output
Hello Sally. You are  26  years old

==== x0544_sprintf_27892 | sprintf | tutorial.txt line 27892 | expected: none
name$ = 'Sally'
age = 26

mytext$ = f$('Hello [[name$]]. You are [[age]] years old')

print mytext$

delay
---- output
Hello Sally. You are 26 years old

==== x0546_sprintf_27916 | sprintf | tutorial.txt line 27916 | expected: none
name$ = 'Sally'
years = 22

print f$('Her name was [[name$]], she was [[years]] years old.')
! Her name was Sally, she was 22 years old.

print f$('[[ucase$(name$)]] has [[len(name$)]] letters')   ! SALLY has 5 letters

print f$('Total: [[sprintf$("%.2m", 1234.5)]]')   ! Total: 1,234.50

delay
---- output
Her name was Sally, she was 22 years old.
SALLY has 5 letters
Total: 1,234.50

==== x0550_sprintf_27984 | sprintf | tutorial.txt line 27984 | expected: none
amount = 1234.5

text$ = f$('Total: [[sprintf$("%.2m", amount)]]')

print text$    ! Total: 1,234.50

delay
---- output
Total: 1,234.50

==== x0551_sprintf_28030 | sprintf | tutorial.txt line 28030 | expected: same
age = 33
print sprintf$('Age is %', age)

name$ = 'Sally Sue'
age = 22
note$ = sprintf$('% is %', name$, age)
print 'Here is my note: '; note$

delay
---- output
Age is 33
Here is my note: Sally Sue is 22

==== x0552_sprintf_28053 | sprintf | tutorial.txt line 28053 | expected: same
print sprintf$('PI is about %r', pi)
print sprintf$('PI is about %i', pi)

delay
---- output
PI is about 3.1415926535897932
PI is about 3

==== x0553_sprintf_28065 | sprintf | tutorial.txt line 28065 | expected: same
print sprintf$('PI is about %.3r', 3.14159265)

delay
---- output
PI is about 3.142

==== x0554_sprintf_28078 | sprintf | tutorial.txt line 28078 | expected: same
ox_counter = 56
print sprintf$('I have % %p.', ox_counter, 'ox')

ox_counter = 1
print sprintf$('I have % %p.', ox_counter, 'ox')

print sprintf$('%p', 'foot')

delay
---- output
I have 56 oxen.
I have 1 ox.
feet

==== x0555_sprintf_28133 | sprintf | tutorial.txt line 28133 | expected: DIFFERENT
f$ = "%tThe party is @month (month# @mm) @dd, @yyyy @mt:@m2:@s2 - or @h2:@m2:@s2 @ampm on a @day"
now_secs = seconds('')
print sprintf$(f$, now_secs)

f$ = '%t@month @dd2-@mon-@yyyy'
now_secs = seconds('20221225 0000')
print sprintf$(f$, now_secs)

print sprintf$('%t@mil Processing starting')

print sprintf$('%t@short Processing starting')

print sprintf$('%t Processing started')

delay
---- output
The party is October (month# 10) 16, 2026 06:19:20 - or 06:19:20 AM on a Friday
December 25-Dec-2022
16-Oct-2026 06:19:20 Processing starting
Oct16 06:19 Processing starting
Oct16 06:19 Processing started

==== x0556_sprintf_28180 | sprintf | tutorial.txt line 28180 | expected: none
my_text$ = 'this is a book title'
print sprintf$('%T', my_text$)  // outputs: This Is a Book Title

delay
---- output
This Is a Book Title

==== x0557_sprintf_28192 | sprintf | tutorial.txt line 28192 | expected: none
ssn$ = '123456789'
print sprintf$('%z SSN: @@@-@@-@@@@', ssn$)
print sprintf$('%z SSN: [1:3]-[4:5]-[6:9]', ssn$)

delay
---- output
 SSN: 123-45-6789
 SSN: 123-45-6789

==== x0558_sprintf_28207 | sprintf | tutorial.txt line 28207 | expected: same
a$='abcdefGHI'
print sprintf$('%z[uc:1:3]-[4:5]-[lc:6:end]', a$)

delay
---- output
ABC-de-fghi

==== x0559_sprintf_28222 | sprintf | tutorial.txt line 28222 | expected: same
cash = 1234567.887
print sprintf$('About $ %.2m', cash)

delay
---- output
About $ 1,234,567.89

==== x0560_sprintf_28275 | sprintf | tutorial.txt line 28275 | expected: none
a = 1234.56
print sprintf$('%r Written:  %w', a, a)

delay
---- output
1234.56 Written:  One thousand two hundred thirty four and 56/100

==== x0561_sprintf_28291 | sprintf | tutorial.txt line 28291 | expected: none
amount = 1234.567
print sprintf$('%r Written:  %w', amount, amount)

delay
---- output
1234.567 Written:  One thousand two hundred thirty four and 56/100

==== x0562_sprintf_28314 | sprintf | tutorial.txt line 28314 | expected: same
print sprintf$('%w', 0)

print sprintf$('%w', 0.75)

print sprintf$('%w', 1.01)

print sprintf$('%w', -42.10)

delay
---- output
Zero and 00/100
Zero and 75/100
One and 01/100
Negative forty two and 10/100

==== x0563_sprintf_28340 | sprintf | tutorial.txt line 28340 | expected: same
tab_pos = 15
age = 45
print sprintf$('The age was: %h%i',tab_pos, age)

delay
---- output
The age was:  45

==== x0564_sprintf_28355 | sprintf | tutorial.txt line 28355 | expected: same
print sprintf$('Number: %10i and more.', 123)

delay
---- output
Number:        123 and more.

==== x0565_sprintf_28365 | sprintf | tutorial.txt line 28365 | expected: same
print sprintf$('Number: %-10i and more.', 123)

delay
---- output
Number: 123        and more.

==== x0566_sprintf_28377 | sprintf | tutorial.txt line 28377 | expected: same
print sprintf$('%i in Octal: %o  Hex: %x  Binary: %b', 123, 123, 123, 123)

delay
---- output
123 in Octal: 173  Hex: 7b  Binary: 1111011

==== x0568_sprintf_28439 | sprintf | tutorial.txt line 28439 | expected: same
print sprintf$('The letter (\0102)')

delay
---- output
The letter (B)

==== x0569_sprintf_28489 | sprintf | tutorial.txt line 28489 | expected: same
print sprintf$('50%% off, % left', 5)

delay
---- output
50% off, 5 left

==== x0570_sprintf_28501 | sprintf | tutorial.txt line 28501 | expected: same
print sprintf$('user@host has % msgs', 3)
print sprintf$('arr[%] set', 7)

delay
---- output
user@host has 3 msgs
arr[7] set

==== x0571_sprintf_28535 | sprintf | tutorial.txt line 28535 | expected: same
print sprintf$('% %p and % %p', 2, 'cat', 1, 'dog')

delay
---- output
2 cats and 1 dog

==== x0573_more_formatted_strings_28686 | more_formatted_strings | tutorial.txt line 28686 | expected: none
name$ = 'Sally'
years = 22
print f$('Her name was [[name$]], she was [[years]] old.')
                                  ! Her name was Sally, she was 22 old.

                                  delay
---- output
Her name was Sally, she was 22 old.

==== x0576_more_formatted_strings_28737 | more_formatted_strings | tutorial.txt line 28737 | expected: none
line$ = '[[who$]] scored [[points]]'
who$ = 'Ann' \ points = 12
print f$(line$)                   ! Ann scored 12
who$ = 'Bob' \ points = 15
print f$(line$)                   ! Bob scored 15

delay
---- output
Ann scored 12
Bob scored 15

==== x0577_more_formatted_strings_28763 | more_formatted_strings | tutorial.txt line 28763 | expected: none
when exception in
  print f$('Dear [[nmae$]],')
use
  print 'no such variable: '; _string$     ! NMAE$
end when

delay
---- output
no such variable: NMAE$

==== x0578_more_formatted_strings_28770 | more_formatted_strings | tutorial.txt line 28770 | expected: none
when exception in
  print f$('open [[years')
use
  print 'template error: '; extext$
end when

delay
---- output
template error: Format is invalid

==== x0579_more_formatted_strings_28786 | more_formatted_strings | tutorial.txt line 28786 | expected: none
print f$('literal [["[["]] here')                    ! literal [[ here
print f$('Write [["[[name$]]"]] to insert a name')   ! Write [[name$]] to insert a name

delay
---- output
literal [[ here
Write [[name$]] to insert a name

==== x0580_string_real_28946 | string_real | tutorial.txt line 28946 | expected: same
print val("123.45") + 1000
x$ = '123abc'
print val(x$, 0)
print _integer
print val(x$, 1)
a$ = "There were 11 cats, each had $10,000.56"
cat_count = val(a$, 1)  // extracts the 11
pocket_money = val(a$, 2) // extracts 10000.56

a$ = 'We bought 3 tickets.  It was -5 degrees outside, We spent 150.34. (858) 829-9506.'

print a$
for i = 1 to 999
  num = val(a$, i)
  if _integer = 0 then exit for
  print i, num
next i

delay
---- output
 1123.45 
 0 
 0 
 123 
We bought 3 tickets.  It was -5 degrees outside, We spent 150.34. (858) 829-9506.
 1  3 
 2 -5 
 3  150.34 
 4  858 
 5  829 
 6  9506

==== x0581_string_real_28992 | string_real | tutorial.txt line 28992 | expected: same
print val("123,234.56", 1, 'sep=","')

print val("123,234.56", 1)

a$ = "The invoice showed (5.612,34) credit"  
opt$ = 'neg="()",euro=",."'  // handle () for negative and Euros
print val(a$, 1, opt$)

delay
---- output
 123 
 123234.56 
-5612.34

==== x0582_string_real_29014 | string_real | tutorial.txt line 29014 | expected: none
a$ = "Widget: $12.99, Weight: 3.45 lbs, Stock: 120"
price = val(a$, 1)
weight = val(a$, 2)
stock = val(a$, 3)
print "Price: "; price
print "Weight: "; weight
print "Stock: "; stock

delay
---- output
Price:  12.99 
Weight:  3.45 
Stock:  120

==== x0584_string_real_29031 | string_real | tutorial.txt line 29031 | expected: none
x$ = "Amount: $1234.56"
amount = val(x$, 1, 'sep="$"')
if _integer > 0 then
  print "Valid amount: "; amount
else
  print "Invalid input."
endif

delay
---- output
Valid amount:  1234.56

==== x0586_string_real_29046 | string_real | tutorial.txt line 29046 | expected: none
report$ = "Revenue: â¬1.234,56; Expenses: â¬987,65"
opt$ = 'euro=",.",sep=";"'
revenue = val(report$, 1, opt$)
expenses = val(report$, 2, opt$)
print "Revenue: "; revenue
print "Expenses: "; expenses

delay
---- output
Revenue:  1234.56 
Expenses:  987.65

==== x0588_string_real_29061 | string_real | tutorial.txt line 29061 | expected: none
log$ = "Temperature: 23.5Â°C, Humidity: 55%, Pressure: 1013 hPa"
temp = val(log$, 1)
humidity = val(log$, 2)
pressure = val(log$, 3)
print "Temperature: "; temp; "Â°C"
print "Humidity: "; humidity; "%"
print "Pressure: "; pressure; " hPa"

delay
---- output
Temperature:  23.5 ÃÂ°C
Humidity:  55 %
Pressure:  1013  hPa

==== x0590_string_real_29078 | string_real | tutorial.txt line 29078 | expected: none
text$ = "Contact: (555) 123-4567 or (555) 987-6543"
opt$ = 'sep=" "'
phone1 = val(text$, 1, opt$)
phone2 = val(text$, 2, opt$)
print "First Phone Number: "; phone1
print "Second Phone Number: "; phone2

delay
---- output
First Phone Number:  555 
Second Phone Number:  123

==== x0592_validation_rules_29234 | validation_rules | tutorial.txt line 29234 | expected: none
  // Expect: 1, 0, 1, 0
  print valid('42',  'integer')
  print valid('4.2', 'integer')
  print valid('4.2', 'number')
  print valid('abc', 'digits')

  delay
  end
---- output
 1 
 0 
 1 
 0

==== x0593_validation_rules_29257 | validation_rules | tutorial.txt line 29257 | expected: none
  // Expect: 1, 0, 0, 1, 0, 1, 0, 1, 0
  print valid('50',     'integer; allow 1 to 120')
  print valid('121',    'integer; allow 1 to 120')
  print valid('abc',    'integer; allow 1 to 120')
  print valid('green',  'allow red, green')
  print valid('13',     'integer; disallow 13')
  print valid('abcdef', 'length 6')
  print valid('abcde',  'length 6')
  print valid('abc',    'minlength 2; maxlength 4')
  print valid('1.255',  'number; decimals 2')

  delay
  end
---- output
 1 
 0 
 0 
 1 
 0 
 1 
 0 
 1 
 0

==== x0594_validation_rules_29282 | validation_rules | tutorial.txt line 29282 | expected: none
  // Expect: 1
  text$  = '01-Jan-99'
  vrule$ = 'date dmony'
  print valid(text$, vrule$)

  delay
  end
---- output
 1

==== x0595_validation_rules_29295 | validation_rules | tutorial.txt line 29295 | expected: none
  // Expect: 1
  text$  = '01-Jan-2000'
  vrule$ = 'date dmoncy'
  print valid(text$, vrule$)

  delay
  end
---- output
 1

==== x0596_validation_rules_29309 | validation_rules | tutorial.txt line 29309 | expected: none
  // Expect: 1 then 1
  text$  = '20000122 010101'
  text2$ = '990122 010101'
  vrule$ = 'fulltime'
  print valid(text$, vrule$)
  print valid(text2$, vrule$)

  delay
  end
---- output
 1 
 1

==== x0597_validation_rules_29329 | validation_rules | tutorial.txt line 29329 | expected: none
  // Expect: 1 then 0
  text$   = 'a b c d'
  text2$  = ' '
  vrule$  = 'required'
  print valid(text$,  vrule$)
  print valid(text2$, vrule$)

  delay
  end
---- output
 1 
 0

==== x0598_validation_rules_29343 | validation_rules | tutorial.txt line 29343 | expected: none
  // Expect: 1, 1, 0
  text$   = 'yes'
  text2$  = 'n'
  text3$  = 'a'
  vrule$  = 'yes/no'
  print valid(text$,  vrule$)
  print valid(text2$, vrule$)
  print valid(text3$, vrule$)

  delay
  end
---- output
 1 
 1 
 0

==== x0599_validation_rules_29360 | validation_rules | tutorial.txt line 29360 | expected: none
  // Expect: 1
  print valid('integer', 'vrules')

  delay
  end
---- output
 1

==== x0600_validation_rules_29370 | validation_rules | tutorial.txt line 29370 | expected: none
  // Expect: 1
  text_str$ = '##.##'
  vrule$    = 'printmask'
  print valid(text_str$, vrule$)

  delay
  end
---- output
 1

==== x0601_validation_rules_29383 | validation_rules | tutorial.txt line 29383 | expected: none
  // Expect: 1 then 0
  text_str$  = 'total = a% + 30'
  text_str2$ = '##~-###'
  vrule$     = 'expression'
  print valid(text_str$,  vrule$)
  print valid(text_str2$, vrule$)

  delay
  end
---- output
 0 
 0

==== x0602_validation_rules_29398 | validation_rules | tutorial.txt line 29398 | expected: none
  // Expect: false path taken
  a$ = "print 'hello, ' name$"
  if not valid(a$, 'code') then
    print 'false'
  end if

  delay
  end
---- output
false

==== x0604_validation_rules_29424 | validation_rules | tutorial.txt line 29424 | expected: none
  // Expect: 1 then 0
  text$  = 'do_totals'
  text2$ = 'test_nos'
  vrule$ = 'routine'
  print valid(text$,  vrule$)
  print valid(text2$, vrule$)

  delay
  end

  routine do_totals:
    private mytotal, desc$
    mytotal = 15
    desc$   = 'Test Totals'
    print desc$; mytotal
  end routine
---- output
 1 
 0

==== x0605_validation_rules_29465 | validation_rules | tutorial.txt line 29465 | expected: none
  // Expect: true, true, true
  text$    = 'abcd10'
  vrules$  = 'filter remove "10"; letters'

  text2$   = 'ab1cd1'
  vrules2$ = "filter replace '1'='e'; letters"

  text3$   = ' 1234  '
  vrules3$ = "filter trim; number"

  if valid(text$,  vrules$)  then print 'true'
  if valid(text2$, vrules2$) then print 'true'
  if valid(text3$, vrules3$) then print 'true'

  delay
  end
---- output
true
true
true

==== x0606_validation_rules_29487 | validation_rules | tutorial.txt line 29487 | expected: none
  // Expect: true
  text$  = "123"
  vrule$ = "filter replace '1'='a'; restore; number"

  if valid(text$, vrule$) then print 'true'

  delay
  end
---- output
true

==== x0608_json_29585 | json | tutorial.txt line 29585 | expected: same
cluster person: id$, name$, age

add cluster person
    person->id$ = "1"
    person->name$ = "Alice"
    person->age = 30
end add

add cluster person
    person->id$ = "2"
    person->name$ = "Bob"
    person->age = 25
end add

json_output$ = JSON$(person, -1)
print json_output$

delay
---- output
{
   "person":[
      {
      "id":"1",
      "name":"Alice",
      "age":30
      },
      {
      "id":"2",
      "name":"Bob",
      "age":25
      }
   ]
}

==== x0610_json_29645 | json | tutorial.txt line 29645 | expected: same
cluster address: street$, city$, zip$
cluster person: id$, name$, age, prefix cluster address

add cluster person
    person->id$ = "1"
    person->name$ = "Alice"
    person->age = 30
    person->address->street$ = "123 Main St"
    person->address->city$ = "Springfield"
    person->address->zip$ = "12345"
end add

add cluster person
    person->id$ = "2"
    person->name$ = "Bob"
    person->age = 25
    person->address->street$ = "456 Elm St"
    person->address->city$ = "Shelbyville"
    person->address->zip$ = "67890"
end add

json_output$ = JSON$(person, -1)
print json_output$

delay
---- output
{
   "person":[
      {
      "id":"1",
      "name":"Alice",
      "age":30,
      "address": {
         "street":"123 Main St",
         "city":"Springfield",
         "zip":"12345"
         }
      },
      {
      "id":"2",
      "name":"Bob",
      "age":25,
      "address": {
         "street":"456 Elm St",
         "city":"Shelbyville",
         "zip":"67890"
         }
      }
   ]
}

==== x0613_json_29745 | json | tutorial.txt line 29745 | expected: same
json_data$ = '{"name":"Alice","age":30,"city":"Springfield"}'

name$ = jsonutil$(json_data$, '/name')
age$ = jsonutil$(json_data$, '/age')
city$ = jsonutil$(json_data$, '/city')

print "Name: "; name$
print "Age: "; age$
print "City: "; city$

delay
---- output
Name: Alice
Age: 30
City: Springfield

==== x0614_json_29767 | json | tutorial.txt line 29767 | expected: same
json_array$ = '[{"name":"Alice","age":30},{"name":"Bob","age":25}]'

first_name$ = jsonutil$(json_array$, '/0/name')
second_age$ = jsonutil$(json_array$, '/1/age')

print "First person: "; first_name$
print "Second person age: "; second_age$

delay
---- output
First person: Alice
Second person age: 25

==== x0615_json_29786 | json | tutorial.txt line 29786 | expected: same
json_data$ = '{"name":"Alice","age":30,"city":"Springfield"}'
print jsonutil$(json_data$)

delay
---- output
{
  "name": "Alice",
  "age": 30,
  "city": "Springfield"
}

==== x0617_json_29837 | json | tutorial.txt line 29837 | expected: none
// Prepare data to send to an API
cluster order: id$, product$, quantity, price

add cluster order
    order->id$ = "ORD001"
    order->product$ = "Widget"
    order->quantity = 5
    order->price = 12.99
end add

// Convert to JSON for API request
api_request$ = JSON$(order, 1)
print "Sending to API: "; api_request$

// Simulate API response
api_response$ = '{"status":"success","order_id":"ORD001","total":64.95}'

// Extract response data
status$ = jsonutil$(api_response$, '/status')
total$ = jsonutil$(api_response$, '/total')

print "API Status: "; status$
print "Order Total: $"; total$

delay
---- output
Sending to API: {
   "order":
      {
      "id":"ORD001",
      "product":"Widget",
      "quantity":5,
      "price":12.99
      }
}

API Status: success
Order Total: $64.95

==== x0624_rndbytes_30156 | rndbytes | tutorial.txt line 30156 | expected: none
phrase$ = "meet me in the Philippines"
otp_key$ = rndbytes$(len(phrase$))
encrypted$ = xor$(phrase$, otp_key$)
for_emailing$ = base64encode$(encrypted$)

print 'Original: '; phrase$
print 'Base64 Encrypted: '; for_emailing$

// Now  decrypt
encrypted_binary$ = base64decode$(for_emailing$)
decrypted_phrase$ = xor$(encrypted_binary$, otp_key$)
print 'Decrypted: '; decrypted_phrase$

delay
---- output
Original: meet me in the Philippines
Base64 Encrypted: iDeV36PWTYvdNp+B4GI+sFv/2ThEceL4u0o=
Decrypted: meet me in the Philippines

==== x0625_date_time_functions_30271 | date_time_functions | tutorial.txt line 30271 | expected: none
print date$                // Default format: YYYYMMDD
print date$(days(date$), 1) // Format: MMDDYYYY
print date$(days(date$), 2) // Format: DDMMYYYY
print date$(days(date$), 3) // Format: dd-Mon-yyyy
print date$(days(date$), 4) // Format: Month dd, yyyy

delay
---- output
20261016
10162026
16102026
16-Oct-2026
October 16, 2026

==== x0626_date_time_functions_30283 | date_time_functions | tutorial.txt line 30283 | expected: none
print days('20000122')      // Returns: 146119
print days('990122')        // Returns: 145754
print days('20000103', 0)   // Returns: 146100
print days('01032000', 1)   // Returns: 146100
print days('03012000', 2)   // Returns: 146100
print days('03-Jan-2000', 3)// Returns: 146100
print days('January 3, 2000', 4) // Returns: 146100
print days('2029-12-25')    // Returns: 157049 (ISO 8601 dashed dates parse directly)

delay
---- output
 146119 
 145754 
 146100 
 146100 
 146100 
 146100 
 146100 
 157049

==== x0627_date_time_functions_30299 | date_time_functions | tutorial.txt line 30299 | expected: none
print day$          // Returns today's day of the week
print day$(12345)   // Returns the day of the week for 12345 days since January 1, 1600

delay
---- output
Friday
Tuesday

==== x0628_date_time_functions_30309 | date_time_functions | tutorial.txt line 30309 | expected: none
print fulltime$          // Returns current date and time
sec = seconds('20000121 115042')
print fulltime$(sec, 0)  // Format: CCYYMMDD HHMMSS
print fulltime$(sec, 1)  // Format: MMDDCCYY HHMMSS
print fulltime$(sec, 2)  // Format: DDMMCCYY HHMMSS
print fulltime$(sec, 3)  // Format: DD-Mon-CCYY HH:MM:SS
print fulltime$(sec, 4)  // Format: Month DD, CCYY HH:MM:SS

delay
---- output
20261016 061927
20000121 115042
01212000 115042
21012000 115042
21-Jan-2000 11:50:42
January 21, 2000 11:50:42

==== x0629_date_time_functions_30324 | date_time_functions | tutorial.txt line 30324 | expected: none
z  = seconds('20000122 103050') // Returns: 12624633050
z1 = seconds('990122 103050')   // Returns: 12593097050
z2 = seconds('103050')          // Returns: 37850 (seconds since midnight)
z3 = seconds('1030')            // Returns: 37800 (seconds since midnight)
z4 = seconds('2029-12-25 14:30:00')  // Returns: 13568999400 (ISO 8601)
z5 = seconds('2029-12-25T14:30:00')  // Returns: 13568999400 (T separator works too)

delay
---- output


==== x0631_date_time_functions_30365 | date_time_functions | tutorial.txt line 30365 | expected: none
print fulltime$(seconds('2029-12-25T14:30:00Z'), 3)
                                     // Returns: 25-Dec-2029 07:30:00 (local)

                                     delay
---- output
25-Dec-2029 07:30:00

==== x0632_date_time_functions_30375 | date_time_functions | tutorial.txt line 30375 | expected: none
print sprintf$('%t@ts', 0)           // Returns: 2026-08-21T18:04:59-07:00
print sprintf$('%t@ts', seconds('2029-12-25 14:30:00'))
                                     // Returns: 2029-12-25T14:30:00-07:00

                                     delay
---- output
2026-10-16T06:19:27-07:00
2029-12-25T14:30:00-07:00

==== x0633_date_time_functions_30385 | date_time_functions | tutorial.txt line 30385 | expected: none
print time(0)  // Returns: Seconds since midnight
print time(1)  // Returns: CPU time of the process
print time(2)  // Returns: Connect time of the process
print time(5)  // Returns: Seconds since Sheerpower was invoked

delay
---- output
 22767 
 0.125 
 0.3839555 
 0.05

==== x0634_date_time_functions_30397 | date_time_functions | tutorial.txt line 30397 | expected: none
print time$        // Returns current time of day
print time$(1800)  // Returns: 00:30
print time$(54178) // Returns: 15:02

delay
---- output
06:19:27
00:30
15:02

==== x0635_common_math_functions_30480 | common_math_functions | tutorial.txt line 30480 | expected: none
print abs(-10)  // Returns: 10
print abs(10)   // Returns: 10

delay
---- output
 10 
 10

==== x0636_common_math_functions_30489 | common_math_functions | tutorial.txt line 30489 | expected: none
print sqrt(64)         // Returns: 8
print sqrt(2)          // Returns: 1.414213562373095
print sqrt(-4 + 0i)    // Returns: 0+2i

delay
---- output
 8 
 1.414213562373095 
 0+2i

==== x0637_common_math_functions_30497 | common_math_functions | tutorial.txt line 30497 | expected: none
print sgn(-238)      // Returns: -1
print sgn(0)         // Returns: 0
print sgn(238)       // Returns: 1

delay
---- output
-1 
 0 
 1

==== x0638_common_math_functions_30507 | common_math_functions | tutorial.txt line 30507 | expected: none
print eps                          // Returns: 0.0000000000000001
print abs(0.1 + 0.2 - 0.3) <= eps  // Returns: 1

delay
---- output
 0.0000000000000001 
 1

==== x0639_common_math_functions_30513 | common_math_functions | tutorial.txt line 30513 | expected: none
print div0(0.8, 0.000004) // Returns: 200000
print div0(0.8, 0.0)      // Returns: 0
print div0(6, 3)          // Returns: 2
print div0(6, 0)          // Returns: 0

delay
---- output
 200000 
 0 
 2 
 0

==== x0640_common_math_functions_30525 | common_math_functions | tutorial.txt line 30525 | expected: none
print div0inf(6, 3)       // Returns: 2
print div0inf(6, 0)       // Returns: Inf
print div0inf(-6, 0)      // Returns: -Inf
print div0inf(0, 0)       // Returns: NaN

delay
---- output
 2 
 Inf 
-Inf 
 NaN

==== x0641_common_math_functions_30540 | common_math_functions | tutorial.txt line 30540 | expected: none
print divr(1, 3) * 3              // Returns: 1
print fraction$(divr(0.05, 12))   // Returns: 1/240
print divr(1, 4)                  // Returns: 0.25

delay
---- output
 1 
1/240
 0.25

==== x0642_common_math_functions_30550 | common_math_functions | tutorial.txt line 30550 | expected: none
print numerator(divr(22, 7))      // Returns: 22
print denominator(divr(22, 7))    // Returns: 7
print denominator(0.25)           // Returns: 4
print decimal(divr(2, 3))         // Returns: 0.6666666666666667

delay
---- output
 22 
 7 
 4 
 0.6666666666666667

==== x0643_common_math_functions_30558 | common_math_functions | tutorial.txt line 30558 | expected: none
print fp(238.304) // Returns: 0.304

delay
---- output
 0.304

==== x0644_common_math_functions_30563 | common_math_functions | tutorial.txt line 30563 | expected: none
print mod(36, 13) // Returns: 10

delay
---- output
 10

==== x0645_common_math_functions_30568 | common_math_functions | tutorial.txt line 30568 | expected: none
print remainder(-4, 3) // Returns: -1

delay
---- output
-1

==== x0646_common_math_functions_30575 | common_math_functions | tutorial.txt line 30575 | expected: none
print sin(0)         // Returns: 0
print sin(1.5708)    // Returns: 1 (approximately)

delay
---- output
 0 
 0.999999999993254

==== x0647_common_math_functions_30581 | common_math_functions | tutorial.txt line 30581 | expected: none
print cos(0)         // Returns: 1
print cos(1.5708)    // Returns: 0 (approximately)

delay
---- output
 1 
-0.0000036732051033

==== x0648_common_math_functions_30587 | common_math_functions | tutorial.txt line 30587 | expected: none
print tan(0)         // Returns: 0
print tan(0.7854)    // Returns: 1 (approximately, pi/4)

delay
---- output
 0 
 1.00000367321185

==== x0649_common_math_functions_30593 | common_math_functions | tutorial.txt line 30593 | expected: none
print sec(0)         // Returns: 1

delay
---- output
 1

==== x0650_common_math_functions_30598 | common_math_functions | tutorial.txt line 30598 | expected: none
print csc(pi / 2)    // Returns: 1

delay
---- output
 1

==== x0651_common_math_functions_30603 | common_math_functions | tutorial.txt line 30603 | expected: none
print cot(pi / 4)    // Returns: 1

delay
---- output
 1

==== x0652_common_math_functions_30608 | common_math_functions | tutorial.txt line 30608 | expected: none
print asin(0)        // Returns: 0
print asin(1)        // Returns: 1.5708 (pi/2)

delay
---- output
 0 
 1.5707963267949

==== x0653_common_math_functions_30614 | common_math_functions | tutorial.txt line 30614 | expected: none
print acos(1)        // Returns: 0
print acos(0)        // Returns: 1.5708 (pi/2)

delay
---- output
 0 
 1.5707963267949

==== x0654_common_math_functions_30621 | common_math_functions | tutorial.txt line 30621 | expected: none
print atan(0)        // Returns: 0
print atan(1)        // Returns: 0.7854 (pi/4)
print atn(1)         // Returns: 0.785398163397448 (the same as atan(1))

delay
---- output
 0 
 0.785398163397448 
 0.785398163397448

==== x0655_common_math_functions_30628 | common_math_functions | tutorial.txt line 30628 | expected: none
print atan(33)        // Returns: 1.5405

delay
---- output
 1.54050256687612

==== x0656_common_math_functions_30633 | common_math_functions | tutorial.txt line 30633 | expected: none
print angle(4, 9)    // Returns: 1.15257

delay
---- output
 1.15257199721567

==== x0657_common_math_functions_30638 | common_math_functions | tutorial.txt line 30638 | expected: none
print deg(pi)        // Returns: 180
print deg(pi / 4)    // Returns: 45

delay
---- output
 180 
 45

==== x0658_common_math_functions_30645 | common_math_functions | tutorial.txt line 30645 | expected: none
print rad(180)       // Returns: 3.1415926535897932
print sin(rad(90))   // Returns: 1

delay
---- output
 3.1415926535897932 
 1

==== x0659_common_math_functions_30651 | common_math_functions | tutorial.txt line 30651 | expected: none
print sinh(0)        // Returns: 0
print sinh(1)        // Returns: 1.1752011936438

delay
---- output
 0 
 1.1752011936438

==== x0660_common_math_functions_30657 | common_math_functions | tutorial.txt line 30657 | expected: none
print cosh(0)        // Returns: 1
print cosh(1)        // Returns: 1.54308063481524

delay
---- output
 1 
 1.54308063481524

==== x0661_common_math_functions_30663 | common_math_functions | tutorial.txt line 30663 | expected: none
print tanh(0)        // Returns: 0
print tanh(1)        // Returns: 0.761594155955765

delay
---- output
 0 
 0.761594155955765

==== x0662_common_math_functions_30671 | common_math_functions | tutorial.txt line 30671 | expected: none
print ceil(2.3)      // Returns: 3
print ceil(-2.3)     // Returns: -2

delay
---- output
 3 
-2

==== x0663_common_math_functions_30677 | common_math_functions | tutorial.txt line 30677 | expected: none
print floor(2.7)     // Returns: 2
print floor(-2.7)    // Returns: -3

delay
---- output
 2 
-3

==== x0664_common_math_functions_30683 | common_math_functions | tutorial.txt line 30683 | expected: none
print int(148.8432)  // Returns: 148

delay
---- output
 148

==== x0665_common_math_functions_30691 | common_math_functions | tutorial.txt line 30691 | expected: none
print int(2.7); integer(2.7)        // Returns: 2  3
print integer(2.5); integer(-2.5)   // Returns: 3 -3
z = integer(4 + (993 * 35))
print z              // Returns: 34759

delay
---- output
 2  3 
 3 -3 
 34759

==== x0666_common_math_functions_30699 | common_math_functions | tutorial.txt line 30699 | expected: none
print ip(1234.56)    // Returns: 1234

delay
---- output
 1234

==== x0667_common_math_functions_30704 | common_math_functions | tutorial.txt line 30704 | expected: none
print round(21.83492, 2) // Returns: 21.83

delay
---- output
 21.83

==== x0668_common_math_functions_30709 | common_math_functions | tutorial.txt line 30709 | expected: none
print truncate(123.45678, 2) // Returns: 123.45
print truncate(123.45678, 4) // Returns: 123.4567

delay
---- output
 123.45 
 123.4567

==== x0669_common_math_functions_30717 | common_math_functions | tutorial.txt line 30717 | expected: none
print rnd         // Returns: 0.94097 (example)
print rnd(100)    // Returns: 56 (example)

delay
---- output
 0.474943935405463 
 25

==== x0670_common_math_functions_30735 | common_math_functions | tutorial.txt line 30735 | expected: none
set seed 7
print rnd(1000); rnd(1000); rnd(1000)   // Returns: 598  300  332
set seed 7
print rnd(1000); rnd(1000); rnd(1000)   // Returns: 598  300  332 (the same three)
randomize
print rnd(1000); rnd(1000); rnd(1000)   // Returns: 954  333  830 (different on every run)

delay
---- output
 598  300  332 
 598  300  332 
 763  174  200

==== x0672_common_math_functions_30756 | common_math_functions | tutorial.txt line 30756 | expected: none
print exp(1)      // Returns: 2.7183
print exp(0)      // Returns: 1

delay
---- output
 2.71828182845905 
 1

==== x0673_common_math_functions_30762 | common_math_functions | tutorial.txt line 30762 | expected: none
print log(1)      // Returns: 0
print log(2.7183) // Returns: 1

delay
---- output
 0 
 1.00000668491399

==== x0674_common_math_functions_30768 | common_math_functions | tutorial.txt line 30768 | expected: none
print log2(8)        // Returns: 3
print log2(1024)     // Returns: 10

delay
---- output
 3 
 10

==== x0675_common_math_functions_30774 | common_math_functions | tutorial.txt line 30774 | expected: none
print log10(1000)    // Returns: 3
print log10(0.001)   // Returns: -3

delay
---- output
 3 
-3

==== x0676_common_math_functions_30780 | common_math_functions | tutorial.txt line 30780 | expected: none
print min(3, 2)   // Returns: 2
print min(-1, -5) // Returns: -5

delay
---- output
 2 
-5

==== x0677_common_math_functions_30786 | common_math_functions | tutorial.txt line 30786 | expected: none
print max(5, 9)   // Returns: 9

delay
---- output
 9

==== x0678_common_math_functions_30791 | common_math_functions | tutorial.txt line 30791 | expected: none
print clamp(15, 1, 10)  // Returns: 10
print clamp(5, 1, 10)   // Returns: 5
print clamp(-3, 1, 10)  // Returns: 1

delay
---- output
 10 
 5 
 1

==== x0679_routines_31080 | routines | tutorial.txt line 31080 | expected: none
process_order with qty 10, price 1.50, returning total
print total

delay

// Parent routine stays short and readable
private routine process_order with qty, price, returning total
  total = 0
  is_vip? = true
  local calculate_totals
  local apply_discounts
end routine

// Local routines (share scope, parent-only)
local routine calculate_totals
  total = qty * price
end routine

local routine apply_discounts
  if is_vip? then total = total * 0.9
end routine
---- output
 13.5

==== x0681_routines_31203 | routines | tutorial.txt line 31203 | expected: none
private routine build_tax_table once
  main$tax_rate_by_state$ = "CA=0.0725|NY=0.0400|TX=0.0625"
end routine

build_tax_table
build_tax_table  // Returns immediately without executing
---- output


==== x0682_routines_31219 | routines | tutorial.txt line 31219 | expected: none
routine get_build_info once, returning version$, build_date$

  version$    = "Sheerpower 1.0"
  build_date$ = "2026-02-28"

end routine
---- output


==== x0685_routines_31315 | routines | tutorial.txt line 31315 | expected: same
routine send_alert with message$, priority$ = "normal"
  print priority$; ": "; message$
end routine

send_alert with message$ = "Backup complete"
send_alert with message$ = "Disk almost full", priority$ = "urgent"
---- output
normal: Backup complete
urgent: Disk almost full

==== x0686_routines_31348 | routines | tutorial.txt line 31348 | expected: same
routine calculate_area with length, width, returning area
  area = length * width
end routine

calculate_area with length = 10, width = 5, 
               returning area room_area
print "The area is: "; room_area
---- output
The area is:  50

==== x0687_routines_31364 | routines | tutorial.txt line 31364 | expected: none
routine calculate_area with length, width, returning area
  area = length * width
end routine

calculate_area with length = 10, width = 5, 
               returning area room_area
print "The area is: "; room_area
---- output
The area is:  50

==== x0688_routines_31375 | routines | tutorial.txt line 31375 | expected: none
routine split_name with full_name$, returning first$, last$
  first$ = element$(full_name$, 1, " ")
  last$ = element$(full_name$, 2, " ")
end routine

split_name with full_name$ = "Anna Rivera",
            returning first$ fname$, last$ lname$

print "First: "; fname$
print "Last: "; lname$
---- output
First: Anna
Last: Rivera

==== x0689_routines_31396 | routines | tutorial.txt line 31396 | expected: none
routine total_of with values(*), returning total
  total = stats$sum(values)
end routine

dim scores(*)
fill scores with 10, 20, 30, 40
total_of with values scores, returning total t
print "Total: "; t                       ! 100

! function form and pipes take arrays too
print total_of(values = scores)
print scores |> total_of()
---- output
Total:  100 
 100 
 100

==== x0690_routines_31416 | routines | tutorial.txt line 31416 | expected: none
routine squares_of with n, returning sq(*)
  redim sq(*)                             ! start empty
  for i = 1 to n
    sq(*) = i * i
  next i
end routine

dim sq(*)
squares_of with n 5, returning sq sq
print sq                                  !  1   4   9  16  25
---- output
 1   4   9  16  25

==== x0692_routines_31515 | routines | tutorial.txt line 31515 | expected: none
x$ = '  hi  '
a$ = x$
   |>trim$()
   |> ucase$()
   |> do_it$()
print a$

delay

routine do_it$ with text$, returning newtext$
  newtext$ = '** ' + text$ + ' ** '
end routine
---- output
** HI **

==== x0694_routines_31538 | routines | tutorial.txt line 31538 | expected: none
dim prices(*), tax(*), piped(*)
fill prices with 100, 250, 40
tax = calc_tax(amount = prices)                 ! three calls, three results
print tax                                       ! 10  25   4
print calc_tax(amount = prices, tax_rate = 0.5) !  50  125   20
print stats$sum(calc_tax(amount = prices))      ! 39
piped = prices |> calc_tax()                    ! 10, 25, 4 -- the pipe maps too

delay

routine calc_tax with amount, tax_rate = 0.1, returning tax
  tax = amount * tax_rate
end routine
---- output
10  25   4
 50  125   20
 39

==== x0695_routines_31637 | routines | tutorial.txt line 31637 | expected: none
routine print_discount with price, returning discounted
  if price <= 0 then
    // Invalid input -- nothing to do
    discounted = 0
    exit routine
  end if

  discounted = price * 0.9
end routine

print_discount with price = -50,
               returning discounted d
print "Discounted price: "; d
---- output
Discounted price:  0

==== x0696_routines_31660 | routines | tutorial.txt line 31660 | expected: none
routine process_payment with amount
  guard amount > 0

  print "Processing payment of "; amount
  // ... payment logic ...
end routine

process_payment with amount = -20
---- output


==== x0698_routines_31711 | routines | tutorial.txt line 31711 | expected: none
routine safe_divide with numer, denom, returning result
  result = 0
  guard denom <> 0

  if numer = 0 then
    exit routine
  end if

  result = numer / denom
end routine


safe_divide with numer = 10, denom = 0,
            returning result r

print "Result: "; r
---- output
Result:  0

==== x0701_routines_31938 | routines | tutorial.txt line 31938 | expected: none
// Divide-by-zero guard using _error and exit routine
routine safe_divide with numer, denom, returning quotient
  if denom = 0 then
    set error on
    exit routine
  end if
  quotient = numer / denom
end routine

// Caller: just check _error
safe_divide with numer = 10, denom = 0, returning quotient q
if _error then
  print "Error: divide by zero"
else
  print "Quotient = "; q
end if
---- output
Error: divide by zero

==== x0702_routines_31957 | routines | tutorial.txt line 31957 | expected: none
// _ROUTINE$ returns the current routine name (string)
routine reconcile_orders with date$, returning count
  print "I am in the routine called "; _routine$
  // ... work ...
  count = 42
end routine
---- output


==== x0704_routine_parameters_detail_32184 | routine_parameters_detail | tutorial.txt line 32184 | expected: none
routine display_value with input_data
    print "Value: "; input_data
    print "Type: "; typeof$(input_data)
    print
end routine

! Calls with different data types
declare dynamic x
x = "Hello World"
display_value with input_data x   ! STRING
x =  123.45 
display_value with input_data x   ! REAL
---- output
Value: Hello World
Type: Name:DISPLAY_VALUE$INPUT_DATA, Dtype:String, *Dynamic*, *Const*

Value:  123.45 
Type: Name:DISPLAY_VALUE$INPUT_DATA, Dtype:Real, *Dynamic*, *Const*, *Narrow*

==== x0705_routine_parameters_detail_32203 | routine_parameters_detail | tutorial.txt line 32203 | expected: none
routine format_output with data, returning formatted_result$
  select case between$(typeof$(data), "Dtype:", " ")
    case "String"
        formatted_result$ = "Text: " + data
    case "Real", "Integer"
        formatted_result$ = "Number: " + str$(data)
    case else
        formatted_result$ = "Unknown type: " + typeof$(data)
  end select
end routine
---- output


==== x0706_routine_parameters_detail_32268 | routine_parameters_detail | tutorial.txt line 32268 | expected: none
routine calculate_tax with income, tax_rate, returning tax_amount
    tax_amount = income * tax_rate
end routine

calculate_tax with income=50_000, tax_rate=0.2, 
              returning tax_amount result
print "Tax Amount: "; result

! Using implied parameter values
income = 50_000
tax_rate = 0.2
calculate_tax with income, tax_rate, returning tax_amount
print "Tax Amount: "; tax_amount
---- output
Tax Amount:  10000 
Tax Amount:  10000

==== x0707_routine_parameters_detail_32290 | routine_parameters_detail | tutorial.txt line 32290 | expected: none
profit = 1234
tax_rate = 6.5/100
calculate_tax_due with amount profit, rate tax_rate, 
                  returning due tax_due
print 'Tax due: '; tax_due

delay

private routine calculate_tax_due with amount, rate, 
                                  returning due
  due = amount * rate
end routine
---- output
Tax due:  80.21

==== x0708_routine_parameters_detail_32326 | routine_parameters_detail | tutorial.txt line 32326 | expected: none
routine analyze_bible_text with bible_content$, 
                           returning word_count
    word_count = elements(bible_content$, " ")
end routine
---- output


==== x0710_routine_parameters_detail_32372 | routine_parameters_detail | tutorial.txt line 32372 | expected: none
routine send_alert with message$, priority$ = "normal"
    print priority$; ": "; message$
end routine

send_alert with message$ "Backup complete"
send_alert with message$ "Disk almost full", priority$ "urgent"
---- output
normal: Backup complete
urgent: Disk almost full

==== x0712_routine_parameters_detail_32420 | routine_parameters_detail | tutorial.txt line 32420 | expected: none
routine calc_tax with amount, tax_rate = 0.12, returning tax
    tax = amount * tax_rate
end routine

calc_tax with amount 200, returning tax due              ! due = 24
total = 1000 + calc_tax(amount = 1000)                   ! 1120, default rate
total = 1000 + calc_tax(amount = 1000, tax_rate = 0.5)   ! 1500
---- output


==== x0714_routine_parameters_detail_32480 | routine_parameters_detail | tutorial.txt line 32480 | expected: none
routine apply_number with n, function fn(), returning result
  result = fn(n)
end routine
---- output


==== x0716_routine_parameters_detail_32503 | routine_parameters_detail | tutorial.txt line 32503 | expected: none
routine apply_text with text$, function fn(), returning out$
  out$ = fn(text$)
end routine

word$ = "Hello World"
apply_text with text$ word$, function ucase$(), returning out$ shouted$
print shouted$      ! HELLO WORLD
---- output
HELLO WORLD

==== x0718_routine_parameters_detail_32532 | routine_parameters_detail | tutorial.txt line 32532 | expected: none
routine apply_pair with a, b, function cmp(), returning result
  result = cmp(a, b)
end routine

routine difference_of with first, second, returning diff
  diff = first - second
end routine

apply_pair with a 30, b 10, function difference_of(), returning result r
print r        ! 20
---- output
 20

==== x0719_routine_parameters_detail_32564 | routine_parameters_detail | tutorial.txt line 32564 | expected: DIFFERENT
routine show_field with label$, value$, function fmt(), returning line$
  line$ = label$ + ": " + fmt(value$)
end routine

show_field with label$ "name", value$ "sara", function ucase$(), returning line$ ln$
print ln$        ! name: SARA
---- output
name: SARA

==== x0720_routine_parameters_detail_32655 | routine_parameters_detail | tutorial.txt line 32655 | expected: same
option legacy

name$ = '  Sally  '
tidy_name with name$
print 'The caller still has: ['; name$; ']'

delay
end

routine tidy_name with name$
  name$ = trim$(name$)
  print 'Inside the routine:   ['; name$; ']'
end routine
---- output
Inside the routine:   [Sally]
The caller still has: [  Sally  ]

==== x0721_routine_parameters_detail_32681 | routine_parameters_detail | tutorial.txt line 32681 | expected: same
option legacy

show_price with item$ 'Coffee', price 3.50
show_price with item$ 'Tea'

delay
end

routine show_price with item$, price
  print item$ + ' costs ' + sprintf$('%.2m', price)
end routine
---- output
Coffee costs 3.50
Tea costs 3.50

==== x0722_routine_parameters_detail_32711 | routine_parameters_detail | tutorial.txt line 32711 | expected: same
option legacy

amount = 12
show_value with value amount
text$ = 'twelve'
show_value with value text$

delay
end

routine show_value with value
  print 'value: '; value
end routine
---- output
value:  12 
value: twelve

==== x0723_routine_parameters_detail_32740 | routine_parameters_detail | tutorial.txt line 32740 | expected: same
option legacy

biggest% = 2147483647
one% = 1
print 'biggest% + one% = '; biggest% + one%
count% = 2147483647
count%++
print 'count% after ++ = '; count%
big = 2147483648
stored% = big
print 'stored% = big   = '; stored%
lowest% = -2147483648
minus_one% = -1
when exception in
  quotient% = lowest% / minus_one%
use
  print 'lowest% / minus_one% still raises: '; extext$
end when

delay
---- output
biggest% + one% = -2147483648 
count% after ++ = -2147483648 
stored% = big   = -2147483648 
lowest% / minus_one% still raises: Integer overflow

==== x0724_routine_parameters_detail_32780 | routine_parameters_detail | tutorial.txt line 32780 | expected: same
option legacy

code$ = 'B'
select case code$
  case 'A' label$ = 'first'
  case 'B' label$ = 'second'
  case else label$ = 'other'
end select
print 'label$ = '; label$

delay
---- output
label$ = second

==== x0725_routine_parameters_detail_32810 | routine_parameters_detail | tutorial.txt line 32810 | expected: same
option legacy

role$ = 'primary'
if ucase$(role$) = 'Primary' then
  print 'matched'
else
  print 'never matches'
end if

delay
---- output
never matches

==== x0726_pass_clusters_32932 | pass_clusters | tutorial.txt line 32932 | expected: none
cluster taxes: name$, profit, tax_rate
taxes->name$ = 'Sally Sue'
taxes->profit = 1234
taxes->tax_rate = 6.5/100

calculate_tax_due with taxes, returning due
print 'Tax due:'; due; 'for '; taxes->name$

delay

private routine calculate_tax_due with taxes, returning due
  due = taxes->profit * taxes->tax_rate
end routine
---- output
Tax due: 80.21 for Sally Sue

==== x0727_pass_clusters_32949 | pass_clusters | tutorial.txt line 32949 | expected: none
// define root cluster
cluster meal: type$, protein$, liquid$, carb$  

// define related clusters
cluster breakfast using meal
cluster lunch using meal

// add data
breakfast->type$ = "Breakfast"
breakfast->protein$ = "eggs"
breakfast->liquid$ = "tea"
breakfast->carb$ = "toast"

lunch->type$ = "Lunch"
lunch->protein$ = "chicken"
lunch->liquid$ = "coffee"
lunch->carb$ = "rice"

delay

private routine show_one_meal with meal
  print cluster meal
end routine

// call the routine
show_one_meal with meal breakfast
show_one_meal with meal lunch
---- output
"Breakfast","eggs","tea","toast"
"Lunch","chicken","coffee","rice"

==== x0728_program_seg_advanced_33069 | program_seg-advanced | tutorial.txt line 33069 | expected: none
private routine process_file

open file in_ch: name "data.txt"
total_count = 0
valid_count = 0
do
local read_data
if eof? then exit do
local validate_data
local update_counts
loop
close #in_ch

end routine

local routine read_data
line input #in_ch, eof eof?: line$
end routine

local routine validate_data
if line$ = "" then return
end routine

local routine update_counts
total_count++
if line$ = "valid_pattern" then valid_count++
end routine
---- output


==== x0729_routine_headers_33166 | routine_headers | tutorial.txt line 33166 | expected: none
routine calculate_fee with amount, returning fee
    fee = amount * 0.0275 + 1.50
end routine
---- output


==== x0732_modules_33367 | modules | tutorial.txt line 33367 | expected: none
module taxes
  routine calculate_tax with amount, rate, returning tax_due
    tax_due = amount * rate
  end routine
end module
---- output


==== x0745_include_files_33887 | include_files | tutorial.txt line 33887 | expected: none
full_name$ = 'Sally Sue'
tax_rate = 6.5

delay

routine do_it
  print 'Doing the routine called '; _routine$
end routine
---- output


==== x0746_include_files_33900 | include_files | tutorial.txt line 33900 | expected: none
%include '@..\safe\safe_common'
print 'The full name is: '; full_name$
do_it

delay
---- output
The full name is: Sally Sue
Doing the routine called DO_IT

==== x0749_include_files_33940 | include_files | tutorial.txt line 33940 | expected: none
// File: logging.inc
routine log_message with msg$
  print "LOG: "; msg$
end routine
---- output


==== x0752_macros_and_blueprints_34169 | macros_and_blueprints | tutorial.txt line 34169 | expected: none
blueprint validator
  validate_[[placeholder]]
  store_[[placeholder]]
end blueprint

delay
---- output


==== x0754_macros_and_blueprints_34201 | macros_and_blueprints | tutorial.txt line 34201 | expected: none
blueprint base_handler
  print "init_{placeholder}"
end blueprint

blueprint extended_handler extends base_handler
  print "last_{placeholder}"
end blueprint
blueprint prepended_handler prepends base_handler
  print "first_{placeholder}"
end blueprint

delay
---- output


==== x0757_macros_and_blueprints_34280 | macros_and_blueprints | tutorial.txt line 34280 | expected: same
    blueprint handler
      print "processing_[[placeholder.lcase]]"
      print "validating_[[placeholder.ucase]]"
      print "completed_[[placeholder.ccase]]"
    end blueprint

    %generate handler with CUSTOMER

    delay
---- output
processing_customer
validating_CUSTOMER
completed_Customer

==== x0758_macros_and_blueprints_34331 | macros_and_blueprints | tutorial.txt line 34331 | expected: same
blueprint handler
  got$ = got$ + "[[placeholder]], "
end blueprint

blueprint handlerxx extends handler
  got$ = got$ + " (extended)"
end blueprint

got$ = ''
%generate handler with age, city, ID
%generate handlerxx with ID__, ID__
print got$

delay
---- output
AGE, CITY, ID, ID01,  (extended)ID02,  (extended)

==== x0759_macros_and_blueprints_34398 | macros_and_blueprints | tutorial.txt line 34398 | expected: none
macro macro_name = value

delay
---- output


==== x0760_macros_and_blueprints_34403 | macros_and_blueprints | tutorial.txt line 34403 | expected: none
macro macro_name value

delay
---- output


==== x0761_macros_and_blueprints_34418 | macros_and_blueprints | tutorial.txt line 34418 | expected: same
macro maxsize = 500
macro maxsize2 500

print 'The maximum size is: '; @maxsize
print 'The other size is  : '; @maxsize2

delay
---- output
The maximum size is:  500 
The other size is  :  500

==== x0762_macros_and_blueprints_34451 | macros_and_blueprints | tutorial.txt line 34451 | expected: none
macro macro_name
  print "[[shortname=sysboot]]"
  print "[[event]] occurred."
end macro

delay
---- output


==== x0763_macros_and_blueprints_34464 | macros_and_blueprints | tutorial.txt line 34464 | expected: none
macro log_event
  print "[[shortname=sysboot]] - [[event=an event]] occurred."
end macro

@log_event (shortname=Emergency, event="System Boot")
@log_event (event="System Boot")
@log_event

delay
---- output
Emergency - System Boot occurred.
sysboot - System Boot occurred.
sysboot - an event occurred.

==== x0766_macros_and_blueprints_34545 | macros_and_blueprints | tutorial.txt line 34545 | expected: none
macro two
  print 'in two'
end macro

macro one
  print 'in one'
  @two  
end macro

@one

delay
---- output
in one
in two

==== x0767_macros_and_blueprints_34562 | macros_and_blueprints | tutorial.txt line 34562 | expected: none
macro age_is = "Your age is [[age=21]] for this project"
print @age_is (age=30)

delay
---- output
Your age is 30 for this project

==== x0768_macros_and_blueprints_34568 | macros_and_blueprints | tutorial.txt line 34568 | expected: none
macro myname = "Sally Sue" + chr$(ascii("!"))
print "This is "; @myname

delay
---- output
This is Sally Sue!

==== x0770_macros_and_blueprints_34589 | macros_and_blueprints | tutorial.txt line 34589 | expected: none
macro mycode
  for i=1 to 10_000_000
  next i
end macro

delay
---- output


==== x0771_macros_and_blueprints_34602 | macros_and_blueprints | tutorial.txt line 34602 | expected: none
macro time_it
  print 'Timing: [[expr]]'
  start timer
  [[expr]]
  print 'elapsed: '; _elapsed
end macro

delay
---- output


==== x0772_macros_and_blueprints_34639 | macros_and_blueprints | tutorial.txt line 34639 | expected: none
blueprint handler
  print "do_read_[[placeholder]]"
  print "do_validate_[[placeholder]]"
  print "do_store_[[placeholder]]"
end blueprint

delay
---- output


==== x0775_choose_macros_or_blueprints_34936 | choose_macros_or_blueprints | tutorial.txt line 34936 | expected: none
macro MAX = 500

delay
---- output


==== x0776_choose_macros_or_blueprints_34940 | choose_macros_or_blueprints | tutorial.txt line 34940 | expected: none
macro trace = print "TRACE [[msg=ok]]"
@trace (msg="starting...")

delay
---- output
TRACE starting...

==== x0777_choose_macros_or_blueprints_34947 | choose_macros_or_blueprints | tutorial.txt line 34947 | expected: none
blueprint crud
  print "read_[[placeholder]]"
  print "validate_[[placeholder]]"
  print "store_[[placeholder]]"
end blueprint
%generate crud with customer, client, employee

delay
---- output
read_CUSTOMER
validate_CUSTOMER
store_CUSTOMER
read_CLIENT
validate_CLIENT
store_CLIENT
read_EMPLOYEE
validate_EMPLOYEE
store_EMPLOYEE

==== x0778_choose_macros_or_blueprints_34958 | choose_macros_or_blueprints | tutorial.txt line 34958 | expected: none
blueprint base
  print "init_[[placeholder]]"
end blueprint
blueprint plus extends base
  print "work_[[placeholder]]"
end blueprint
%generate plus with order

delay
---- output
init_ORDER
work_ORDER

==== x0779_conditional_compilation_35101 | conditional_compilation | tutorial.txt line 35101 | expected: none
%defined _spversion >= 'V011.006'
%++ print "Using features available in Sheerpower V011.006 or later."
%-- print "Update Sheerpower to use these features."
%end defined

%defined _user = 'admin'
%++ print "Admin-specific debugging enabled."
%-- print "Standard user mode. No admin-specific features enabled."
%end defined

delay
---- output
Using features available in Sheerpower V011.006 or later.
Standard user mode. No admin-specific features enabled.

==== x0780_conditional_compilation_35121 | conditional_compilation | tutorial.txt line 35121 | expected: none
macro debug_mode xxx

%defined debug_mode
%++ print "Debug mode is defined."
%++ print "More debug mode code"
%-- print "Debug mode was not defined."
%>> print "This code always runs."
%end defined

delay
---- output
Debug mode is defined.
More debug mode code
This code always runs.

==== x0781_conditional_compilation_35186 | conditional_compilation | tutorial.txt line 35186 | expected: none
macro windows_version = 10

%defined windows_version >= '11'
%++ print "Windows version is 11 or higher."
%-- print "Windows version is below 11."
%end defined

%defined windows_version >= 8
%++ print "Windows version is 8 or higher."
%-- print "Windows version is below 8."
%end defined

macro build_type = "production"

%defined build_type = "production"
%++ print "This is a production build."
%-- print "This is a regular build."
%end defined

delay
---- output
Windows version is below 11.
Windows version is 8 or higher.
This is a production build.

==== x0782_conditional_compilation_35224 | conditional_compilation | tutorial.txt line 35224 | expected: none
%defined DEBUG_MODE
%++ print "Debugging information shown."
%>> print "General runtime information."
%-- print "No debugging information."
%end defined

delay
---- output
General runtime information.
No debugging information.

==== x0788_large_application_architectu_35715 | large_application_architecture | tutorial.txt line 35715 | expected: none
// @customer_data.spinc

routine customer_exists with cust_id$, returning exists?
  exists? = false

  // Lookup customer record here.
  // Set exists? to true if the customer is found.

end routine


routine get_customer_name with cust_id$, returning name$
  name$ = ""

  // Lookup customer record here.
  // Return the customer name.

end routine
---- output


==== x0789_large_application_architectu_35749 | large_application_architecture | tutorial.txt line 35749 | expected: none
// invoice_rules.spinc

routine invoice_can_be_posted with invoice_id$,  returning ok?
  ok? = false

  // Check whether the invoice exists.
  // Check whether the customer exists.
  // Check whether the invoice has detail lines.
  // Check whether the invoice has already been posted.

end routine


routine calculate_invoice_total with invoice_id$, returning total
  total = 0

  // Read invoice detail lines.
  // Add taxable and non-taxable amounts.
  // Apply discounts and taxes.

end routine
---- output


==== x0792_large_application_architectu_35887 | large_application_architecture | tutorial.txt line 35887 | expected: none
// format_utils.spinc

routine calc_money with amount, returning text$
  text$ = sprintf$("%m", amount)
end routine


routine yes_no with flag?, returning text$
  if flag? then
    text$ = "Yes"
  else
    text$ = "No"
  end if
end routine
---- output


==== x0801_large_application_architectu_36226 | large_application_architecture | tutorial.txt line 36226 | expected: none
routine calculate_invoice_total with invoice_id$, returning total
  total = 0

  // The caller provides only the invoice ID.
  // The routine knows how to find the needed detail records.

end routine
---- output


==== x0803_large_application_architectu_36297 | large_application_architecture | tutorial.txt line 36297 | expected: none
// invoice_rules.spinc
//
// This module owns invoice business rules.
// It may call invoice_data and customer_data routines.
// It should not print reports or display menus.
---- output


==== x0804_large_application_architectu_36316 | large_application_architecture | tutorial.txt line 36316 | expected: none
// ------------------------------------------------------------
// Module: invoice_rules.spinc
//
// Purpose:
//   Owns invoice validation, posting rules, and invoice totals.
//
// Public routines:
//   invoice_can_be_posted?
//   calculate_invoice_total
//   post_invoice
//
// Private helpers:
//   get_invoice_subtotal
//   calculate_invoice_tax
//
// Depends on:
//   invoice_data.spsrc
//   customer_data.spsrc
// ------------------------------------------------------------
---- output


==== x0808_unit_testing_36575 | unit_testing | tutorial.txt line 36575 | expected: none
option test on
%test print 'We are in test mode'
age = 15
%test age = 25
debug show age

delay
---- output
We are in test mode
AGE = 25

==== x0811_unit_testing_36607 | unit_testing | tutorial.txt line 36607 | expected: none
option test off

delay
---- output


==== x0813_profiling_37039 | profiling | tutorial.txt line 37039 | expected: none
debug on
stats on

delay
---- output


==== x0817_profiling_37137 | profiling | tutorial.txt line 37137 | expected: none
x = 90
start timer
for i=1 to 1_000_000
  y = sin(x)
next i
print 'Elapsed time: '; _elapsed

delay
---- output
Elapsed time:  0.11

==== x0818_profiling_37230 | profiling | tutorial.txt line 37230 | expected: same
report_mode
debug on
report_mode
debug off
report_mode

delay
end

routine report_mode
  if _debug then
    print "debugging is ON   (_debug = "; _debug; ")"
  else
    print "debugging is off  (_debug = "; _debug; ")"
  end if
end routine
---- output
debugging is off  (_debug =  0 )
debugging is ON   (_debug =  1 )
debugging is off  (_debug =  0 )

==== x0824_Crash_Analysis_37463 | Crash Analysis | tutorial.txt line 37463 | expected: none
// completed validation
validate_order$item_count = 5
validate_order$error_flag = false

// completed tax calculation
calculate_tax$local_rate = 8.5
calculate_tax$tax_amount = 127.50

// current crashing routine
print_invoice$line_count = 47

delay
---- output


==== x0825_Crash_Analysis_37515 | Crash Analysis | tutorial.txt line 37515 | expected: none
cluster customer:
  string name$,
  string nodump password$,
  string nodump api_token$,
  string dump public_id$

  delay
---- output


==== x0826_Crash_Analysis_37525 | Crash Analysis | tutorial.txt line 37525 | expected: none
type nodump string secret // a custom data type of "secret"
declare secret password$

declare string nodump api_token$
declare string nodump ssn$

cluster list: a, b, nodump c, d, dump e, f
// Mixes nodump and the default (dump)

delay
---- output


==== x0829_Coding_insights_37810 | Coding_insights | tutorial.txt line 37810 | expected: none
routine check_value with num
  if num > 10 then
    print "High"
  else
    print "Low"
  end if
end routine
---- output


==== x0832_memlimit_38036 | memlimit | tutorial.txt line 38036 | expected: none
option memlimit 4000
counter = 300_000_000
a$ = repeat$('x', counter)

delay
---- output


==== x0836_todo_38147 | todo | tutorial.txt line 38147 | expected: none
%todo SSue Improve performance of this loop since it is a "hot spot"

delay
---- output
$error |C:\myprograms\x0836_todo_38147.spsrc|1 |1 |%todo SSue Improve performance of this loop since it is a "hot spot"

==== x0837_todo_38170 | todo | tutorial.txt line 38170 | expected: none
%todo JD Refactor this loop to reduce memory usage
%todo AL Investigate why login fails on invalid tokens
%todo MP Optimize sort algorithm for large datasets

delay
---- output
$error |C:\myprograms\x0837_todo_38170.spsrc|1 |1 |%todo JD Refactor this loop to reduce memory usage
$error |C:\myprograms\x0837_todo_38170.spsrc|2 |1 |%todo AL Investigate why login fails on invalid tokens
$error |C:\myprograms\x0837_todo_38170.spsrc|3 |1 |%todo MP Optimize sort algorithm for large datasets

==== x0838_todo_38179 | todo | tutorial.txt line 38179 | expected: none
%todo JD Fix
%todo AL ???
%todo MP Look at this

delay
---- output
$error |C:\myprograms\x0838_todo_38179.spsrc|1 |1 |%todo JD Fix
$error |C:\myprograms\x0838_todo_38179.spsrc|2 |1 |%todo AL ???
$error |C:\myprograms\x0838_todo_38179.spsrc|3 |1 |%todo MP Look at this

==== x0839_deploying_38318 | deploying | tutorial.txt line 38318 | expected: none
set icon "@todo.ico"

delay
---- output


==== x0843_deploying_38620 | deploying | tutorial.txt line 38620 | expected: none
%compile "Client: Acme Corp"  
%compile "LicenseKey: ABC123-XYZ789"  
%compile "Expires: 2026-12-31"

delay
---- output


==== x0853_database_practical_39058 | database_practical | tutorial.txt line 39058 | expected: none
unlock all

delay
---- output


==== x0854_database_practical_39068 | database_practical | tutorial.txt line 39068 | expected: none
unlock table payroll: commit

delay
---- output


==== x0855_database_practical_39078 | database_practical | tutorial.txt line 39078 | expected: none
unlock all: commit

delay
---- output


==== x0883_database_practical_39871 | database_practical | tutorial.txt line 39871 | expected: none
close table tablename

delay
---- output


==== x0884_database_practical_39876 | database_practical | tutorial.txt line 39876 | expected: none
close table: all

delay
---- output


==== x0887_database_practical_39912 | database_practical | tutorial.txt line 39912 | expected: none
close table payroll

delay
---- output


==== x0898_create_ars_41019 | create_ars | tutorial.txt line 41019 | expected: none
<center>
<img src="/images/create_ars/1.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/1.png"><p>
</center>

==== x0899_create_ars_41026 | create_ars | tutorial.txt line 41026 | expected: none
<center>
<img src="/images/create_ars/2.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/2.png"><p>
</center>

==== x0900_create_ars_41033 | create_ars | tutorial.txt line 41033 | expected: none
<center>
<img src="/images/create_ars/3.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/3.png"><p>
</center>

==== x0901_create_ars_41040 | create_ars | tutorial.txt line 41040 | expected: none
<center>
<img src="/images/create_ars/4.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/4.png"><p>
</center>

==== x0902_create_ars_41047 | create_ars | tutorial.txt line 41047 | expected: none
<center>
<img src="/images/create_ars/5.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/5.png"><p>
</center>

==== x0903_create_ars_41054 | create_ars | tutorial.txt line 41054 | expected: none
<center>
<img src="/images/create_ars/6.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/6.png"><p>
</center>

==== x0904_create_ars_41061 | create_ars | tutorial.txt line 41061 | expected: none
<center>
<img src="/images/create_ars/7.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/7.png"><p>
</center>

==== x0905_create_ars_41068 | create_ars | tutorial.txt line 41068 | expected: none
<center>
<img src="/images/create_ars/8.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/8.png"><p>
</center>

==== x0906_create_ars_41075 | create_ars | tutorial.txt line 41075 | expected: none
<center>
<img src="/images/create_ars/9.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/9.png"><p>
</center>

==== x0907_create_ars_41082 | create_ars | tutorial.txt line 41082 | expected: none
<center>
<img src="/images/create_ars/10.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/10.png"><p>
</center>

==== x0908_create_ars_41089 | create_ars | tutorial.txt line 41089 | expected: none
<center>
<img src="/images/create_ars/11.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/11.png"><p>
</center>

==== x0909_create_ars_41096 | create_ars | tutorial.txt line 41096 | expected: none
<center>
<img src="/images/create_ars/12.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/12.png"><p>
</center>

==== x0910_create_ars_41103 | create_ars | tutorial.txt line 41103 | expected: none
<center>
<img src="/images/create_ars/13.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/13.png"><p>
</center>

==== x0911_create_ars_41110 | create_ars | tutorial.txt line 41110 | expected: none
<center>
<img src="/images/create_ars/14.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/14.png"><p>
</center>

==== x0912_create_ars_41117 | create_ars | tutorial.txt line 41117 | expected: none
<center>
<img src="/images/create_ars/15.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/15.png"><p>
</center>

==== x0913_create_ars_41124 | create_ars | tutorial.txt line 41124 | expected: none
<center>
<img src="/images/create_ars/16.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/16.png"><p>
</center>

==== x0914_create_ars_41131 | create_ars | tutorial.txt line 41131 | expected: none
<center>
<img src="/images/create_ars/17.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/17.png"><p>
</center>

==== x0915_create_ars_41138 | create_ars | tutorial.txt line 41138 | expected: none
<center>
<img src="/images/create_ars/18.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/18.png"><p>
</center>

==== x0916_create_ars_41145 | create_ars | tutorial.txt line 41145 | expected: none
<center>
<img src="/images/create_ars/19.png"><p>
</center>
---- output
<center>
<img src="/images/create_ars/19.png"><p>
</center>

==== x0925_exceptions_41659 | exceptions | tutorial.txt line 41659 | expected: none
code = 300
when exception in
  c$ = chr$(code)
use
  print "problem: "; extext$
  print "detail:  "; _string$
end when

delay
---- output
problem: Illegal argument to CHR$()
detail:  chr$(300): the code must be 0..255

==== x0929_exceptions_41800 | exceptions | tutorial.txt line 41800 | expected: none
routine do_b
  // Raises DIVBY0 if y = 0
  x = 10 / y
  print "do_b finished"     // not reached if exception occurs
end routine

routine do_a
  print "in do_a"
  do_b
  print "leaving do_a"      // skipped when exception in do_b
end routine

y = 0 // force a divide by zero in routine do_b

when exception in
  do_a                      // nested calls under protection
use
  if extype = exceptiontype("divby0") then
    print "Handler: fixing y and retrying..."
    y = 1
    retry                   // re-executes the failing statement in do_b -- (10 / y)
  else
    print "Unexpected: "; extext$
    continue
  end if
end when

print "after protected block"
---- output
in do_a
Handler: fixing y and retrying...
do_b finished
leaving do_a
after protected block

==== x0931_strings_as_code_42214 | strings_as_code | tutorial.txt line 42214 | expected: none
a = 45
b = 10
c$ = 'a*b + pi'
declare dynamic d
d = eval(c$)
print d

delay
---- output
 453.1415926535897932

==== x0932_strings_as_code_42238 | strings_as_code | tutorial.txt line 42238 | expected: none
when exception in
    result = eval("5/0")
use
    if _integer = 3001 then
        print "division by zero"
    else
        print "invalid expression: "; extext$
    end if
end when

delay
---- output
division by zero

==== x0973_After_Sheerpower_is_installe_44736 | After Sheerpower is installed | tutorial.txt line 44736 | expected: none
greeting$ = "Hello, world!"
print greeting$

delay
end
---- output
Hello, world!

==== x0990_user_input_45376 | user_input | tutorial.txt line 45376 | expected: none
line input area 5, 10, 8, 60: text$ 
print at 10, 1: 'Rewrapped text' 
wt$ = wrap$(text$, 1, 30) 
print wt$ 

delay
end
---- output

Rewrapped text

==== x0995_making_console_applications_45605 | making_console_applications | tutorial.txt line 45605 | expected: DIFFERENT
line input 'Your name: ': n1$
line input prompt 'Your name: ': n2$
line input n3$
print n1$; '|'; n2$; '|'; n3$

delay
---- output
Your name: ? 
Your name: 

||

==== x1002_making_console_applications_45781 | making_console_applications | tutorial.txt line 45781 | expected: DIFFERENT
line input 'Enter a comment, press Enter, enter a comment': comment_1$, comment_2$
print comment_1$
print comment_2$

delay
---- output
Enter a comment, press Enter, enter a comment? 
Enter a comment, press Enter, enter a comment?

==== x1004_making_console_applications_45875 | making_console_applications | tutorial.txt line 45875 | expected: DIFFERENT
line input 'Answer within 5 seconds', timeout 5, elapsed took: a$
print 'answer ['; a$; '] took '; took; ' seconds'

delay
---- output
Answer within 5 seconds? 
answer [] took  0  seconds

==== x1005_making_console_applications_45885 | making_console_applications | tutorial.txt line 45885 | expected: DIFFERENT
line input 'Line', eof done?: a$
print 'first ['; a$; '] done '; done?
line input 'Line', eof done?: b$
print 'second ['; b$; '] done '; done?

delay
---- output
Line? 
first [] done  1 
Line? 
second [] done  1

==== x1006_making_console_applications_45911 | making_console_applications | tutorial.txt line 45911 | expected: DIFFERENT
line input 'Name', at 5, 10: n$
print 'hello '; n$

delay
---- output
Name? 
hello

==== x1008_making_console_applications_45955 | making_console_applications | tutorial.txt line 45955 | expected: same
print 'integer 32   '; valid('32', 'integer')
print 'integer abc  '; valid('abc', 'integer')
print 'number 3.5   '; valid('3.5', 'number')
print 'required ""  '; valid('', 'required')
print 'digits 12a   '; valid('12a', 'digits')
print 'letters abc  '; valid('abc', 'letters')
print 'date ymd     '; valid('20260920', 'date ymd')
print 'two rules ok '; valid('12345', 'digits; minlength 5')
print 'two rules no '; valid('1234', 'digits; minlength 5')

delay
---- output
integer 32    1 
integer abc   0 
number 3.5    1 
required ""   0 
digits 12a    0 
letters abc   1 
date ymd      1 
two rules ok  1 
two rules no  0

==== x1009_making_console_applications_45987 | making_console_applications | tutorial.txt line 45987 | expected: none
when exception in
  input 'Name', timeout 4.5: name$
use
  name$ = 'guest'
end when

delay
---- output
Name?

==== x1010_making_console_applications_46007 | making_console_applications | tutorial.txt line 46007 | expected: DIFFERENT
line input area 5, 10, 8, 60: text$
print at 10, 1: 'Rewrapped text'
print wrap$(text$, 1, 30)

delay
---- output

Rewrapped text

==== x1043_making_console_applications_46774 | making_console_applications | tutorial.txt line 46774 | expected: none
message 'number is', 123; 456; 789

delay
---- output
-- number is 123456789

==== x1047_making_console_applications_46888 | making_console_applications | tutorial.txt line 46888 | expected: same
print using '{date}?': '990122'
print using '{date dmcy}?': '990122'
print using '{date mdcy}##/##/####': '20000115'
print using '{rotate 3}?': '5552527800'
print using '{rotate 3}###~ ###~-####': '5552527800'
print using '{time}?': '1022'
print using '{time}?': '19:45:36'
print using '{zipcode}?': '92126'
print using '{zipcode}?': 'K8A3P9'
print using '{zipcode}?': '931327845'

delay
---- output
01221999
22011999
01/15/2000
8005552527
800 555-2527
10:22 AM
07:45:36 PM
92126
K8A 3P9
93132-7845

==== x1079_htmx_fastcgi_dictionary_49222 | htmx_fastcgi_dictionary | tutorial.txt line 49222 | expected: none
<style>
  :root {
    --bg: #0f172a;
    --bg-soft: #111827;
    --accent: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.18);
    --accent-strong: #0ea5e9;
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --error: #f97373;
    --card-bg: #020617;
    --border-subtle: #1f2937;
  }

  html, body {
    margin: 0;
    padding: 0;
    height: 100%;
  }

  body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
                 sans-serif;
    background: radial-gradient(circle at top, #1e293b 0, #020617 55%, #000 100%);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }

  .page-shell {
    width: 100%;
    max-width: 720px;
    margin: 3rem 1rem;
  }

  .header {
    text-align: center;
    margin-bottom: 2rem;
  }

  .badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
  }

  h1 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: 0.03em;
  }

  .subtitle {
    margin: 0.4rem 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
  }

  .card {
    background: linear-gradient(135deg, var(--card-bg), var(--bg-soft));
    border-radius: 14px;
    border: 1px solid var(--border-subtle);
    padding: 1.2rem 1.4rem 1.4rem;
    margin-bottom: 1.2rem;
    box-shadow:
      0 16px 40px rgba(0, 0, 0, 0.65),
      0 0 0 1px rgba(15, 23, 42, 0.9);
  }

  .card-title {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--accent);
  }

  .card-title.small {
    font-size: 0.95rem;
  }

  .lookup-form {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 0.9rem;
    flex-wrap: wrap;
  }

  .lookup-form input[type="text"] {
    flex: 1 1 220px;
    padding: 0.55rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease,
                background 0.15s ease;
  }

  .lookup-form input[type="text"]::placeholder {
    color: #6b7280;
  }

  .lookup-form input[type="text"]:focus {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
    background: #020617;
  }

  .lookup-form button {
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--accent-strong);
    background: radial-gradient(circle at top left,
                                var(--accent-strong),
                                #0369a1);
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.1s ease;
  }

  .lookup-form button:hover {
    filter: brightness(1.05);
    box-shadow: 0 10px 20px rgba(8, 47, 73, 0.9);
    transform: translateY(-1px);
  }

  .lookup-form button:active {
    transform: translateY(0);
    box-shadow: none;
    filter: brightness(0.96);
  }

  .htmx-indicator {
    font-size: 0.84rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.12s ease;
  }

  .htmx-request .htmx-indicator {
    opacity: 1;
  }

  .definition-panel {
    min-height: 3rem;
    border-radius: 12px;
    padding: 0.85rem 0.9rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px dashed rgba(148, 163, 184, 0.5);
    transition: background 0.15s ease, border-color 0.15s ease;
    font-size: 0.96rem;
  }

  .definition-card h2 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
    color: var(--accent);
  }

  .definition-card .word {
    font-weight: 600;
    font-size: 1.02rem;
    letter-spacing: 0.05em;
  }

  .definition-card .def {
    margin-top: 0.3rem;
    color: var(--text-main);
  }

  .definition-card .meta {
    margin-top: 0.55rem;
    font-size: 0.8rem;
    color: var(--text-muted);
  }

  .error {
    color: var(--error);
    font-weight: 600;
  }

  .help-card {
    background: radial-gradient(circle at top left,
                                rgba(56, 189, 248, 0.32),
                                var(--bg-soft));
  }

  .tips-list {
    margin: 0.2rem 0 0;
    padding-left: 1.1rem;
    color: var(--text-main);
    font-size: 0.9rem;
  }

  .tips-list li + li {
    margin-top: 0.2rem;
  }

  code {
    font-family: "JetBrains Mono", SFMono-Regular, Menlo, Monaco,
                 Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85rem;
    background: rgba(15, 23, 42, 0.9);
    padding: 0.05rem 0.25rem;
    border-radius: 4px;
    border: 1px solid rgba(30, 64, 175, 0.7);
  }

  @media (max-width: 520px) {
    .lookup-form {
      align-items: stretch;
    }
    .lookup-form button {
      width: 100%;
      justify-content: center;
      text-align: center;
    }
  }
</style>
---- output
<style>
  :root {
    --bg: #0f172a;
    --bg-soft: #111827;
    --accent: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.18);
    --accent-strong: #0ea5e9;
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --error: #f97373;
    --card-bg: #020617;
    --border-subtle: #1f2937;
  }

  html, body {
    margin: 0;
    padding: 0;
    height: 100%;
  }

  body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
                 sans-serif;
    background: radial-gradient(circle at top, #1e293b 0, #020617 55%, #000 100%);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }

  .page-shell {
    width: 100%;
    max-width: 720px;
    margin: 3rem 1rem;
  }

  .header {
    text-align: center;
    margin-bottom: 2rem;
  }

  .badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
  }

  h1 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: 0.03em;
  }

  .subtitle {
    margin: 0.4rem 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
  }

  .card {
    background: linear-gradient(135deg, var(--card-bg), var(--bg-soft));
    border-radius: 14px;
    border: 1px solid var(--border-subtle);
    padding: 1.2rem 1.4rem 1.4rem;
    margin-bottom: 1.2rem;
    box-shadow:
      0 16px 40px rgba(0, 0, 0, 0.65),
      0 0 0 1px rgba(15, 23, 42, 0.9);
  }

  .card-title {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--accent);
  }

  .card-title.small {
    font-size: 0.95rem;
  }

  .lookup-form {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 0.9rem;
    flex-wrap: wrap;
  }

  .lookup-form input[type="text"] {
    flex: 1 1 220px;
    padding: 0.55rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease,
                background 0.15s ease;
  }

  .lookup-form input[type="text"]::placeholder {
    color: #6b7280;
  }

  .lookup-form input[type="text"]:focus {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.5);
    background: #020617;
  }

  .lookup-form button {
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--accent-strong);
    background: radial-gradient(circle at top left,
                                var(--accent-strong),
                                #0369a1);
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.1s ease;
  }

  .lookup-form button:hover {
    filter: brightness(1.05);
    box-shadow: 0 10px 20px rgba(8, 47, 73, 0.9);
    transform: translateY(-1px);
  }

  .lookup-form button:active {
    transform: translateY(0);
    box-shadow: none;
    filter: brightness(0.96);
  }

  .htmx-indicator {
    font-size: 0.84rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.12s ease;
  }

  .htmx-request .htmx-indicator {
    opacity: 1;
  }

  .definition-panel {
    min-height: 3rem;
    border-radius: 12px;
    padding: 0.85rem 0.9rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px dashed rgba(148, 163, 184, 0.5);
    transition: background 0.15s ease, border-color 0.15s ease;
    font-size: 0.96rem;
  }

  .definition-card h2 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
    color: var(--accent);
  }

  .definition-card .word {
    font-weight: 600;
    font-size: 1.02rem;
    letter-spacing: 0.05em;
  }

  .definition-card .def {
    margin-top: 0.3rem;
    color: var(--text-main);
  }

  .definition-card .meta {
    margin-top: 0.55rem;
    font-size: 0.8rem;
    color: var(--text-muted);
  }

  .error {
    color: var(--error);
    font-weight: 600;
  }

  .help-card {
    background: radial-gradient(circle at top left,
                                rgba(56, 189, 248, 0.32),
                                var(--bg-soft));
  }

  .tips-list {
    margin: 0.2rem 0 0;
    padding-left: 1.1rem;
    color: var(--text-main);
    font-size: 0.9rem;
  }

  .tips-list li + li {
    margin-top: 0.2rem;
  }

  code {
    font-family: "JetBrains Mono", SFMono-Regular, Menlo, Monaco,
                 Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85rem;
    background: rgba(15, 23, 42, 0.9);
    padding: 0.05rem 0.25rem;
    border-radius: 4px;
    border: 1px solid rgba(30, 64, 175, 0.7);
  }

  @media (max-width: 520px) {
    .lookup-form {
      align-items: stretch;
    }
    .lookup-form button {
      width: 100%;
      justify-content: center;
      text-align: center;
    }
  }
</style>

==== x1082_lesson1_49934 | lesson1 | tutorial.txt line 49934 | expected: none
    print "Hello, World!"

    delay
---- output
Hello, World!

==== x1083_lesson1_49945 | lesson1 | tutorial.txt line 49945 | expected: none
    print "Hello, World!"
    
    message$ = "Welcome to Sheerpower!"
    print message$

    delay
---- output
Hello, World!
Welcome to Sheerpower!

==== x1084_lesson1_49957 | lesson1 | tutorial.txt line 49957 | expected: none
    print "Hello, World!"
    
    message$ = "Welcome to Sheerpower!"
    print message$
    
    num1 = 8
    num2 = 12
    sum = num1 + num2
    print "The sum of "; num1; " and "; num2; " is "; sum

    delay
---- output
Hello, World!
Welcome to Sheerpower!
The sum of  8  and  12  is  20

==== x1085_lesson1_49974 | lesson1 | tutorial.txt line 49974 | expected: none
    print "Hello, World!"
    
    message$ = "Welcome to Sheerpower!"
    print message$
    
    num1 = 8
    num2 = 12
    sum = num1 + num2
    print "The sum of "; num1; " and "; num2; " is "; sum
    
    num1 = 15
    num2 = 4

    difference = num1 - num2
    product = num1 * num2

    print "The difference between "; num1; " and "; num2; " is "; difference
    print "The product of "; num1; " and "; num2; " is "; product

    delay
---- output
Hello, World!
Welcome to Sheerpower!
The sum of  8  and  12  is  20 
The difference between  15  and  4  is  11 
The product of  15  and  4  is  60

==== x1086_lesson1_50000 | lesson1 | tutorial.txt line 50000 | expected: none
    print "Hello, World!"
    
    message$ = "Welcome to Sheerpower!"
    print message$
    
    num1 = 8
    num2 = 12
    sum = num1 + num2
    print "The sum of "; num1; " and "; num2; " is "; sum
    
    num1 = 15
    num2 = 4

    difference = num1 - num2
    product = num1 * num2

    print "The difference between "; num1; " and "; num2; " is "; difference
    print "The product of "; num1; " and "; num2; " is "; product
    
    sum = 0
    for i = 1 to 5
      sum = sum + i
    next i
    print "The sum of numbers from 1 to 5 is "; sum

    delay
---- output
Hello, World!
Welcome to Sheerpower!
The sum of  8  and  12  is  20 
The difference between  15  and  4  is  11 
The product of  15  and  4  is  60 
The sum of numbers from 1 to 5 is  15

==== x1087_lesson1_50032 | lesson1 | tutorial.txt line 50032 | expected: none
    print "Hello, World!"
    
    message$ = "Welcome to Sheerpower!"
    print message$
    
    num1 = 8
    num2 = 12
    sum = num1 + num2
    print "The sum of "; num1; " and "; num2; " is "; sum
    
    num1 = 15
    num2 = 4

    difference = num1 - num2
    product = num1 * num2

    print "The difference between "; num1; " and "; num2; " is "; difference
    print "The product of "; num1; " and "; num2; " is "; product
    
    sum = 0
    for i = 1 to 5
      sum = sum + i
    next i
    print "The sum of numbers from 1 to 5 is "; sum
    
    num = 7

    if mod(num,2)= 0 then
      print "The number "; num; " is even."
    else
      print "The number "; num; " is odd."
    end if

    delay
---- output
Hello, World!
Welcome to Sheerpower!
The sum of  8  and  12  is  20 
The difference between  15  and  4  is  11 
The product of  15  and  4  is  60 
The sum of numbers from 1 to 5 is  15 
The number  7  is odd.

==== x1088_lesson2_50106 | lesson2 | tutorial.txt line 50106 | expected: none
    tax_rate = 5.5
    fullname$ = 'Sally Sue'
    is_wonderful? = true
    counter% = 50

    delay
---- output


==== x1089_lesson2_50129 | lesson2 | tutorial.txt line 50129 | expected: none
    tax_rate = 5.5
    fullname$ = 'Sally Sue'
    is_wonderful? = true
    counter% = 50
    
    declare real price
    declare string product_name$
    declare integer quantity
    declare boolean in_stock?
    declare dynamic misc_data

    price = 19.99
    product_name$ = "Widget"
    quantity = 100
    in_stock? = true
    misc_data = "Sample text"
    print product_name$; " costs $"; price; " and we have "; quantity; " in stock."

    delay
---- output
Widget costs $ 19.99  and we have  100  in stock.

==== x1096_lesson3_50471 | lesson3 | tutorial.txt line 50471 | expected: none
    dim ages(5)   // five reals:  1, 2, 3, 4, and 5
    dim names$(5) // five string elements.

    ages(1) = 25
    ages(2) = 30
    ages(3) = 45
    ages(4) = 50
    ages(5) = 60

    names$(1) = "Alice"
    names$(2) = "Bob"
    names$(3) = "Charlie"
    names$(4) = "Diana"
    names$(5) = "Eve"

    print "Age of Alice: "; ages(1)
    print "Name of person with age 45: "; names$(3)

    delay
---- output
Age of Alice:  25 
Name of person with age 45: Charlie

==== x1097_lesson3_50496 | lesson3 | tutorial.txt line 50496 | expected: none
    dim ages(5)   // five reals:  1, 2, 3, 4, and 5
    dim names$(5) // five string elements.

    ages(1) = 25
    ages(2) = 30
    ages(3) = 45
    ages(4) = 50
    ages(5) = 60

    names$(1) = "Alice"
    names$(2) = "Bob"
    names$(3) = "Charlie"
    names$(4) = "Diana"
    names$(5) = "Eve"

    print "Age of Alice: "; ages(1)
    print "Name of person with age 45: "; names$(3)
    
    dim weekly_hours(7, 24)  // 7 days a week, 24 hours a day

    // Assign random hours for each day
    for day = 1 to 7
      for hour = 1 to 24
        weekly_hours(day, hour) = rnd(8)
      next hour
    next day

    // Print hours worked on the first day of the week
    print "Hours worked on Monday:"
    for hour = 1 to 24
      print "Hour "; hour; ": "; weekly_hours(1, hour)
    next hour

    delay
---- output
Age of Alice:  25 
Name of person with age 45: Charlie
Hours worked on Monday:
Hour  1 :  6 
Hour  2 :  5 
Hour  3 :  3 
Hour  4 :  6 
Hour  5 :  6 
Hour  6 :  6 
Hour  7 :  3 
Hour  8 :  8 
Hour  9 :  6 
Hour  10 :  5 
Hour  11 :  2 
Hour  12 :  4 
Hour  13 :  4 
Hour  14 :  1 
Hour  15 :  6 
Hour  16 :  8 
Hour  17 :  2 
Hour  18 :  2 
Hour  19 :  5 
Hour  20 :  6 
Hour  21 :  8 
Hour  22 :  6 
Hour  23 :  8 
Hour  24 :  8

==== x1098_lesson3_50545 | lesson3 | tutorial.txt line 50545 | expected: none
    dim ages(5)   // five reals:  1, 2, 3, 4, and 5
    dim names$(5) // five string elements.

    ages(1) = 25
    ages(2) = 30
    ages(3) = 45
    ages(4) = 50
    ages(5) = 60

    names$(1) = "Alice"
    names$(2) = "Bob"
    names$(3) = "Charlie"
    names$(4) = "Diana"
    names$(5) = "Eve"

    print "Age of Alice: "; ages(1)
    print "Name of person with age 45: "; names$(3)
    
    dim weekly_hours(7, 24)  // 7 days a week, 24 hours a day

    // Assign random hours for each day
    for day = 1 to 7
      for hour = 1 to 24
        weekly_hours(day, hour) = rnd(8)
      next hour
    next day

    // Print hours worked on the first day of the week
    print "Hours worked on Monday:"
    for hour = 1 to 24
      print "Hour "; hour; ": "; weekly_hours(1, hour)
    next hour
    
    max_ages = 5
    dim ages(max_ages)  // five reals:  1, 2, 3, 4, and 5

    max_ages = 10
    redim ages(max_ages)  // Now we have 10 elements

    ages(6) = 65
    ages(7) = 70
    print "New age added: "; ages(6)

    delay
---- output
Age of Alice:  25 
Name of person with age 45: Charlie
Hours worked on Monday:
Hour  1 :  7 
Hour  2 :  5 
Hour  3 :  2 
Hour  4 :  7 
Hour  5 :  1 
Hour  6 :  7 
Hour  7 :  1 
Hour  8 :  2 
Hour  9 :  4 
Hour  10 :  8 
Hour  11 :  2 
Hour  12 :  1 
Hour  13 :  6 
Hour  14 :  7 
Hour  15 :  7 
Hour  16 :  7 
Hour  17 :  8 
Hour  18 :  8 
Hour  19 :  6 
Hour  20 :  7 
Hour  21 :  5 
Hour  22 :  6 
Hour  23 :  8 
Hour  24 :  4 
New age added:  65

==== x1099_lesson3_50595 | lesson3 | tutorial.txt line 50595 | expected: none
    dim ages(5)   // five reals:  1, 2, 3, 4, and 5
    dim names$(5) // five string elements.

    ages(1) = 25
    ages(2) = 30
    ages(3) = 45
    ages(4) = 50
    ages(5) = 60

    names$(1) = "Alice"
    names$(2) = "Bob"
    names$(3) = "Charlie"
    names$(4) = "Diana"
    names$(5) = "Eve"

    print "Age of Alice: "; ages(1)
    print "Name of person with age 45: "; names$(3)
    
    dim weekly_hours(7, 24)  // 7 days a week, 24 hours a day

    // Assign random hours for each day
    for day = 1 to 7
      for hour = 1 to 24
        weekly_hours(day, hour) = rnd(8)
      next hour
    next day

    // Print hours worked on the first day of the week
    print "Hours worked on Monday:"
    for hour = 1 to 24
      print "Hour "; hour; ": "; weekly_hours(1, hour)
    next hour
    
    max_ages = 5
    dim ages(max_ages)  // five reals:  1, 2, 3, 4, and 5

    max_ages = 10
    redim ages(max_ages)  // Now we have 10 elements

    ages(6) = 65
    ages(7) = 70
    print "New age added: "; ages(6)
    
    dim cash(0)  // this is how we declare a dynamically expanding array

    cash(0) = 10.99
    cash(1) = 20.50

    print 'Cash elements:'; size(cash)

    delay
---- output
Age of Alice:  25 
Name of person with age 45: Charlie
Hours worked on Monday:
Hour  1 :  5 
Hour  2 :  2 
Hour  3 :  3 
Hour  4 :  3 
Hour  5 :  3 
Hour  6 :  8 
Hour  7 :  6 
Hour  8 :  7 
Hour  9 :  8 
Hour  10 :  2 
Hour  11 :  6 
Hour  12 :  2 
Hour  13 :  1 
Hour  14 :  8 
Hour  15 :  6 
Hour  16 :  5 
Hour  17 :  3 
Hour  18 :  6 
Hour  19 :  5 
Hour  20 :  6 
Hour  21 :  7 
Hour  22 :  7 
Hour  23 :  7 
Hour  24 :  7 
New age added:  65 
Cash elements: 1

==== x1100_lesson3_50652 | lesson3 | tutorial.txt line 50652 | expected: none
    dim ages(5)   // five reals:  1, 2, 3, 4, and 5
    dim names$(5) // five string elements.

    ages(1) = 25
    ages(2) = 30
    ages(3) = 45
    ages(4) = 50
    ages(5) = 60

    names$(1) = "Alice"
    names$(2) = "Bob"
    names$(3) = "Charlie"
    names$(4) = "Diana"
    names$(5) = "Eve"

    print "Age of Alice: "; ages(1)
    print "Name of person with age 45: "; names$(3)
    
    dim weekly_hours(7, 24)  // 7 days a week, 24 hours a day

    // Assign random hours for each day
    for day = 1 to 7
      for hour = 1 to 24
        weekly_hours(day, hour) = rnd(8)
      next hour
    next day

    // Print hours worked on the first day of the week
    print "Hours worked on Monday:"
    for hour = 1 to 24
      print "Hour "; hour; ": "; weekly_hours(1, hour)
    next hour
    
    max_ages = 5
    dim ages(max_ages)  // five reals:  1, 2, 3, 4, and 5

    max_ages = 10
    redim ages(max_ages)  // Now we have 10 elements

    ages(6) = 65
    ages(7) = 70
    print "New age added: "; ages(6)
    
    dim cash(0)  // this is how we declare a dynamically expanding array

    cash(0) = 10.99
    cash(1) = 20.50

    print 'Cash elements:'; size(cash)
    
    dim dice(5)  // five dice

    for idx = 1 to 5
      dice(idx) = rnd(6)  // assign each die a random number between 1 and 6
      print 'dice#'; idx; ' value '; dice(idx)
    next idx

    delay
---- output
Age of Alice:  25 
Name of person with age 45: Charlie
Hours worked on Monday:
Hour  1 :  3 
Hour  2 :  6 
Hour  3 :  7 
Hour  4 :  8 
Hour  5 :  3 
Hour  6 :  1 
Hour  7 :  5 
Hour  8 :  3 
Hour  9 :  6 
Hour  10 :  6 
Hour  11 :  4 
Hour  12 :  4 
Hour  13 :  2 
Hour  14 :  8 
Hour  15 :  2 
Hour  16 :  7 
Hour  17 :  8 
Hour  18 :  1 
Hour  19 :  4 
Hour  20 :  4 
Hour  21 :  6 
Hour  22 :  5 
Hour  23 :  2 
Hour  24 :  5 
New age added:  65 
Cash elements: 1 
dice# 1  value  5 
dice# 2  value  5 
dice# 3  value  1 
dice# 4  value  5 
dice# 5  value  6

==== x1101_lesson4_50747 | lesson4 | tutorial.txt line 50747 | expected: none
    cluster meals: protein$, liquid$, carb$

    meals->protein$ = "Eggs"
    meals->liquid$ = "Tea"
    meals->carb$ = "Toast"

    print "Protein: "; meals->protein$
    print "Liquid: "; meals->liquid$
    print "Carb: "; meals->carb$

    delay
---- output
Protein: Eggs
Liquid: Tea
Carb: Toast

==== x1102_lesson4_50764 | lesson4 | tutorial.txt line 50764 | expected: none
    cluster meals: protein$, liquid$, carb$

    meals->protein$ = "Eggs"
    meals->liquid$ = "Tea"
    meals->carb$ = "Toast"
    
    cluster breakfast using meals
      breakfast->protein$ = "Eggs"
      breakfast->liquid$ = "Tea"
      breakfast->carb$ = "Toast"

    cluster lunch using meals
      lunch->protein$ = "Chicken"
      lunch->liquid$ = "Coffee"
      lunch->carb$ = "Rice"

    cluster dinner using meals
      dinner->protein$ = "Steak"
      dinner->liquid$ = "Wine"
      dinner->carb$ = "Rice"

    print "Breakfast: "; breakfast->protein$; ", "; breakfast->liquid$; ", "; breakfast->carb$
    print "Lunch: "; lunch->protein$; ", "; lunch->liquid$; ", "; lunch->carb$
    print "Dinner: "; dinner->protein$; ", "; dinner->liquid$; ", "; dinner->carb$

    delay
---- output
Breakfast: Eggs, Tea, Toast
Lunch: Chicken, Coffee, Rice
Dinner: Steak, Wine, Rice

==== x1103_lesson4_50796 | lesson4 | tutorial.txt line 50796 | expected: none
    cluster meals: protein$, liquid$, carb$

    meals->protein$ = "Eggs"
    meals->liquid$ = "Tea"
    meals->carb$ = "Toast"
    
    cluster breakfast using meals
      breakfast->protein$ = "Eggs"
      breakfast->liquid$ = "Tea"
      breakfast->carb$ = "Toast"

    cluster lunch using meals
      lunch->protein$ = "Chicken"
      lunch->liquid$ = "Coffee"
      lunch->carb$ = "Rice"

    cluster dinner using meals
      dinner->protein$ = "Steak"
      dinner->liquid$ = "Wine"
      dinner->carb$ = "Rice"

    print "Breakfast: "; breakfast->protein$; ", "; breakfast->liquid$; ", "; breakfast->carb$
    print "Lunch: "; lunch->protein$; ", "; lunch->liquid$; ", "; lunch->carb$
    print "Dinner: "; dinner->protein$; ", "; dinner->liquid$; ", "; dinner->carb$
    
    cluster diet: protein$ = "Steak", 
                  liquid$  = "Wine", 
                  carb$    = "Rice",
                  calories = 2000

    print "Diet plan:"
    print "Protein: "; diet->protein$
    print "Liquid: "; diet->liquid$
    print "Carb: "; diet->carb$
    print "Calories: "; diet->calories

    delay
---- output
Breakfast: Eggs, Tea, Toast
Lunch: Chicken, Coffee, Rice
Dinner: Steak, Wine, Rice
Diet plan:
Protein: Steak
Liquid: Wine
Carb: Rice
Calories:  2000

==== x1104_lesson4_50839 | lesson4 | tutorial.txt line 50839 | expected: none
    cluster meals: protein$, liquid$, carb$
    
    meals->protein$ = "Eggs"
    meals->liquid$ = "Tea"
    meals->carb$ = "Toast"
    
    cluster breakfast using meals
      breakfast->protein$ = "Eggs"
      breakfast->liquid$ = "Tea"
      breakfast->carb$ = "Toast"

    cluster lunch using meals
      lunch->protein$ = "Chicken"
      lunch->liquid$ = "Coffee"
      lunch->carb$ = "Rice"

    cluster dinner using meals
      dinner->protein$ = "Steak"
      dinner->liquid$ = "Wine"
      dinner->carb$ = "Rice"

    print "Breakfast: "; breakfast->protein$; ", "; breakfast->liquid$; ", "; breakfast->carb$
    print "Lunch: "; lunch->protein$; ", "; lunch->liquid$; ", "; lunch->carb$
    print "Dinner: "; dinner->protein$; ", "; dinner->liquid$; ", "; dinner->carb$
    
    cluster diet: protein$ = "Steak", 
                  liquid$  = "Wine", 
                  carb$    = "Rice",
                  calories = 2000

    print "Diet plan:"
    print "Protein: "; diet->protein$
    print "Liquid: "; diet->liquid$
    print "Carb: "; diet->carb$
    print "Calories: "; diet->calories
    
    print cluster meals, list

    delay
---- output
Breakfast: Eggs, Tea, Toast
Lunch: Chicken, Coffee, Rice
Dinner: Steak, Wine, Rice
Diet plan:
Protein: Steak
Liquid: Wine
Carb: Rice
Calories:  2000 
--- Row 0 ---
MEALS->PROTEIN$ = "Eggs" (4)
MEALS->LIQUID$ = "Tea" (3)
MEALS->CARB$ = "Toast" (5)

==== x1105_lesson4_50885 | lesson4 | tutorial.txt line 50885 | expected: none
    cluster meals: protein$, liquid$, carb$
    
    meals->protein$ = "Eggs"
    meals->liquid$ = "Tea"
    meals->carb$ = "Toast"
    
    cluster breakfast using meals
      breakfast->protein$ = "Eggs"
      breakfast->liquid$ = "Tea"
      breakfast->carb$ = "Toast"

    cluster lunch using meals
      lunch->protein$ = "Chicken"
      lunch->liquid$ = "Coffee"
      lunch->carb$ = "Rice"

    cluster dinner using meals
      dinner->protein$ = "Steak"
      dinner->liquid$ = "Wine"
      dinner->carb$ = "Rice"

    print "Breakfast: "; breakfast->protein$; ", "; breakfast->liquid$; ", "; breakfast->carb$
    print "Lunch: "; lunch->protein$; ", "; lunch->liquid$; ", "; lunch->carb$
    print "Dinner: "; dinner->protein$; ", "; dinner->liquid$; ", "; dinner->carb$
    
    cluster diet: protein$ = "Steak", 
                  liquid$  = "Wine", 
                  carb$    = "Rice",
                  calories = 2000

    print "Diet plan:"
    print "Protein: "; diet->protein$
    print "Liquid: "; diet->liquid$
    print "Carb: "; diet->carb$
    print "Calories: "; diet->calories
    
    print cluster meals, list
    
    cluster meal: protein$, liquid$, carb$, calories

    meal->protein$ = "Chicken"
    meal->liquid$ = "Juice"
    meal->carb$ = "Bread"
    meal->calories = 600

    calculate_calories with meal

    delay

    private routine calculate_calories with meal
      print "Total calories in the meal: "; meal->calories
    end routine
---- output
Breakfast: Eggs, Tea, Toast
Lunch: Chicken, Coffee, Rice
Dinner: Steak, Wine, Rice
Diet plan:
Protein: Steak
Liquid: Wine
Carb: Rice
Calories:  2000 
--- Row 0 ---
MEALS->PROTEIN$ = "Eggs" (4)
MEALS->LIQUID$ = "Tea" (3)
MEALS->CARB$ = "Toast" (5)
Total calories in the meal:  600

==== x1106_lesson5_50972 | lesson5 | tutorial.txt line 50972 | expected: none
    cluster student: name$, age, level

    add cluster student
      student->name$ = "Joan Ark"
      student->age = 18
      student->level = 12
    end add

    print student->name$
    print student->age
    print student->level

    delay
---- output
Joan Ark
 18 
 12

==== x1107_lesson5_50993 | lesson5 | tutorial.txt line 50993 | expected: none
    cluster student: name$, age, level

    add cluster student
      student->name$ = "Joan Ark"
      student->age = 18
      student->level = 12

    add cluster student
      student->name$ = "John Smith"
      student->age = 16
      student->level = 10
    end add

    add cluster student
      student->name$ = "Desmond Jones"
      student->age = 15
      student->level = 10
    end add

    print "Current student: "; student->name$

    delay
---- output
Current student: Desmond Jones

==== x1108_lesson5_51021 | lesson5 | tutorial.txt line 51021 | expected: none
    cluster student: name$, age, level

    add cluster student
      student->name$ = "Joan Ark"
      student->age = 18
      student->level = 12

    add cluster student
      student->name$ = "John Smith"
      student->age = 16
      student->level = 10
    end add

    add cluster student
      student->name$ = "Desmond Jones"
      student->age = 15
      student->level = 10
    end add

    print "Total students: "; size(student)

    set cluster student: row 1
    print "First student: "; student->name$

    delay
---- output
Total students:  3 
First student: Joan Ark

==== x1109_lesson5_51052 | lesson5 | tutorial.txt line 51052 | expected: none
    cluster student: name$, age, level

    add cluster student
      student->name$ = "Joan Ark"
      student->age = 18
      student->level = 12
    end add

    add cluster student
      student->name$ = "John Smith"
      student->age = 16
      student->level = 10
    end add

    add cluster student
      student->name$ = "Desmond Jones"
      student->age = 15
      student->level = 10
    end add

    ages = 0
    counter = 0

    collect cluster student
      print student->name$, student->age, student->level
      ages = ages + student->age
      counter++
    end collect

    print 'The average age is '; ages/counter

    delay
---- output
Joan Ark 18  12 
John Smith 16  10 
Desmond Jones 15  10 
The average age is  16.3333333333333333

==== x1110_lesson5_51090 | lesson5 | tutorial.txt line 51090 | expected: none
    cluster student: name$, age, level

    add cluster student
      student->name$ = "Joan Ark"
      student->age = 18
      student->level = 12
    end add

    add cluster student
      student->name$ = "John Smith"
      student->age = 16
      student->level = 10
    end add

    add cluster student
      student->name$ = "Desmond Jones"
      student->age = 15
      student->level = 10
    end add

    collect cluster student
      sort by student->name$
    end collect

    for each student
      print student->name$; ' '; student->age
    next student

    print
    collect cluster student
      include student->age  >  16
      sort by student->name$
    end collect

    for each student
      print student->name$; ' '; student->age
    next student

    delay
---- output
Desmond Jones  15 
Joan Ark  18 
John Smith  16 

Joan Ark  18

==== x1111_lesson5_51135 | lesson5 | tutorial.txt line 51135 | expected: none
    cluster student: name$, age, level

    add cluster student
      student->name$ = "Joan Ark"
      student->age = 18
      student->level = 12
    end add

    add cluster student
      student->name$ = "John Smith"
      student->age = 16
      student->level = 10
    end add

    add cluster student
      student->name$ = "Desmond Jones"
      student->age = 15
      student->level = 10
    end add

    row = findrow(student->name$, "Joan Ark")
    if row > 0 then
      set cluster student: row row
      print "Found student: "; student->name$
    else
      print "Student not found."
    end if

    delay
---- output
Found student: Joan Ark

==== x1112_Guessing_Game_51416 | Guessing Game | tutorial.txt line 51416 | expected: none
target = rnd(100)
print target

delay
---- output
 71

==== x1116_sieve_51763 | sieve | tutorial.txt line 51763 | expected: none
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! Program: PrimeNumbers.spsrc
! System : Prime Number Calculation
! Author : ChatGPT
! Date   : June 21, 2024
! Purpose: Calculate and display prime numbers up to a given upper bound.
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

! Initialization
const upper_bound = 100_000

print 'This program returns the prime numbers'
print 'less or equal than an upper bound determined by you.'

start timer

! Perform Sieve of Eratosthenes
do_sieve

print 'Number of primes from zero to'; upper_bound; ': '; sieve; 'primes found.'
print 'Elapsed time in seconds: '; _elapsed

! Display prime numbers
display_primes

delay

stop

!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!         R o u t i n e s
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! Routine: do_sieve
! Purpose: Perform the Sieve of Eratosthenes to find prime numbers.
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
routine do_sieve
  dim flags?(1 to upper_bound)
  ! Initialize array to assume all numbers are prime
  for i = 2 to upper_bound
    flags?(i) = true
  next i
  
  ! Sieve process
  up_to_here = sqrt(upper_bound)
  for i = 2 to up_to_here
    if flags?(i) = false then iterate for
    for j = i to (upper_bound / i)
      flags?(i * j) = false
    next j
    sieve = sieve + 1
  next i
  
  ! Count remaining primes
  for i = up_to_here + 1 to upper_bound
    if flags?(i) = true then sieve = sieve + 1
  next i
end routine

!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! Routine: display_primes
! Purpose: Display the prime numbers found by the sieve.
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
routine display_primes
  for i = 1 to upper_bound
    if flags?(i) = true then print i,
  next i
  print
end routine

end
---- output
This program returns the prime numbers
less or equal than an upper bound determined by you.
Number of primes from zero to 100000 :  9592 primes found.
Elapsed time in seconds:  0.062 
 2  3  5  7  11  13  17  19  23  29  31  37  41  43  47  53  59  61  67  71  73  79  83  89  97  101  103  107  109  113  127  131  137  139  149  151  157  163  167  173  179  181  191  193  197  199  211  223  227  229  233  239  241  251  257  263  269  271  277  281  283  293  307  311  313  317  331  337  347  349  353  359  367  373  379  383  389  397  401  409  419  421  431  433  439  443  449  457  461  463  467  479  487  491  499  503  509  521  523  541  547  557  563  569  571  577  587  593  599  601  607  613  617  619  631  641  643  647  653  659  661  673  677  683  691  701  709  719  727  733  739  743  751  757  761  769  773  787  797  809  811  821  823  827  829  839  853  857  859  863  877  881  883  887  907  911  919  929  937  941  947  953  967  971  977  983  991  997  1009  1013  1019  1021  1031  1033  1039  1049  1051  1061  1063  1069  1087  1091  1093  1097  1103  1109  1117  1123  1129  1151  1153  1163  1171  1181  1187  1193  1201  1213  1217  1223  1229  1231  1237  1249  1259  1277  1279  1283  1289  1291  1297  1301  1303  1307  1319  1321  1327  1361  1367  1373  1381  1399  1409  1423  1427  1429  1433  1439  1447  1451  1453  1459  1471  1481  1483  1487  1489  1493  1499  1511  1523  1531  1543  1549  1553  1559  1567  1571  1579  1583  1597  1601  1607  1609  1613  1619  1621  1627  1637  1657  1663  1667  1669  1693  1697  1699  1709  1721  1723  1733  1741  1747  1753  1759  1777  1783  1787  1789  1801  1811  1823  1831  1847  1861  1867  1871  1873  1877  1879  1889  1901  1907  1913  1931  1933  1949  1951  1973  1979  1987  1993  1997  1999  2003  2011  2017  2027  2029  2039  2053  2063  2069  2081  2083  2087  2089  2099  2111  2113  2129  2131  2137  2141  2143  2153  2161  2179  2203  2207  2213  2221  2237  2239  2243  2251  2267  2269  2273  2281  2287  2293  2297  2309  2311  2333  2339  2341  2347  2351  2357  2371  2377  2381  2383  2389  2393  2399  2411  2417  2423  2437  2441  2447  2459  2467  2473  2477  2503  2521  2531  2539  2543  2549  2551  2557  2579  2591  2593  2609  2617  2621  2633  2647  2657  2659  2663  2671  2677  2683  2687  2689  2693  2699  2707  2711  2713  2719  2729  2731  2741  2749  2753  2767  2777  2789  2791  2797  2801  2803  2819  2833  2837  2843  2851  2857  2861  2879  2887  2897  2903  2909  2917  2927  2939  2953  2957  2963  2969  2971  2999  3001  3011  3019  3023  3037  3041  3049  3061  3067  3079  3083  3089  3109  3119  3121  3137  3163  3167  3169  3181  3187  3191  3203  3209  3217  3221  3229  3251  3253  3257  3259  3271  3299  3301  3307  3313  3319  3323  3329  3331  3343  3347  3359  3361  3371  3373  3389  3391  3407  3413  3433  3449  3457  3461  3463  3467  3469  3491  3499  3511  3517  3527  3529  3533  3539  3541  3547  3557  3559  3571  3581  3583  3593  3607  3613  3617  3623  3631  3637  3643  3659  3671  3673  3677  3691  3697  3701  3709  3719  3727  3733  3739  3761  3767  3769  3779  3793  3797  3803  3821  3823  3833  3847  3851  3853  3863  3877  3881  3889  3907  3911  3917  3919  3923  3929  3931  3943  3947  3967  3989  4001  4003  4007  4013  4019  4021  4027  4049  4051  4057  4073  4079  4091  4093  4099  4111  4127  4129  4133  4139  4153  4157  4159  4177  4201  4211  4217  4219  4229  4231  4241  4243  4253  4259  4261  4271  4273  4283  4289  4297  4327  4337  4339  4349  4357  4363  4373  4391  4397  4409  4421  4423  4441  4447  4451  4457  4463  4481  4483  4493  4507  4513  4517  4519  4523  4547  4549  4561  4567  4583  4591  4597  4603  4621  4637  4639  4643  4649  4651  4657  4663  4673  4679  4691  4703  4721  4723  4729  4733  4751  4759  4783  4787  4789  4793  4799  4801  4813  4817  4831  4861  4871  4877  4889  4903  4909  4919  4931  4933  4937  4943  4951  4957  4967  4969  4973  4987  4993  4999  5003  5009  5011  5021  5023  5039  5051  5059  5077  5081  5087  5099  5101  5107  5113  5119  5147  5153  5167  5171  5179  5189  5197  5209  5227  5231  5233  5237  5261  5273  5279  5281  5297  5303  5309  5323  5333  5347  5351  5381  5387  5393  5399  5407  5413  5417  5419  5431  5437  5441  5443  5449  5471  5477  5479  5483  5501  5503  5507  5519  5521  5527  5531  5557  5563  5569  5573  5581  5591  5623  5639  5641  5647  5651  5653  5657  5659  5669  5683  5689  5693  5701  5711  5717  5737  5741  5743  5749  5779  5783  5791  5801  5807  5813  5821  5827  5839  5843  5849  5851  5857  5861  5867  5869  5879  5881  5897  5903  5923  5927  5939  5953  5981  5987  6007  6011  6029  6037  6043  6047  6053  6067  6073  6079  6089  6091  6101  6113  6121  6131  6133  6143  6151  6163  6173  6197  6199  6203  6211  6217  6221  6229  6247  6257  6263  6269  6271  6277  6287  6299  6301  6311  6317  6323  6329  6337  6343  6353  6359  6361  6367  6373  6379  6389  6397  6421  6427  6449  6451  6469  6473  6481  6491  6521  6529  6547  6551  6553  6563  6569  6571  6577  6581  6599  6607  6619  6637  6653  6659  6661  6673  6679  6689  6691  6701  6703  6709  6719  6733  6737  6761  6763  6779  6781  6791  6793  6803  6823  6827  6829  6833  6841  6857  6863  6869  6871  6883  6899  6907  6911  6917  6947  6949  6959  6961  6967  6971  6977  6983  6991  6997  7001  7013  7019  7027  7039  7043  7057  7069  7079  7103  7109  7121  7127  7129  7151  7159  7177  7187  7193  7207  7211  7213  7219  7229  7237  7243  7247  7253  7283  7297  7307  7309  7321  7331  7333  7349  7351  7369  7393  7411  7417  7433  7451  7457  7459  7477  7481  7487  7489  7499  7507  7517  7523  7529  7537  7541  7547  7549  7559  7561  7573  7577  7583  7589  7591  7603  7607  7621  7639  7643  7649  7669  7673  7681  7687  7691  7699  7703  7717  7723  7727  7741  7753  7757  7759  7789  7793  7817  7823  7829  7841  7853  7867  7873  7877  7879  7883  7901  7907  7919  7927  7933  7937  7949  7951  7963  7993  8009  8011  8017  8039  8053  8059  8069  8081  8087  8089  8093  8101  8111  8117  8123  8147  8161  8167  8171  8179  8191  8209  8219  8221  8231  8233  8237  8243  8263  8269  8273  8287  8291  8293  8297  8311  8317  8329  8353  8363  8369  8377  8387  8389  8419  8423  8429  8431  8443  8447  8461  8467  8501  8513  8521  8527  8537  8539  8543  8563  8573  8581  8597  8599  8609  8623  8627  8629  8641  8647  8663  8669  8677  8681  8689  8693  8699  8707  8713  8719  8731  8737  8741  8747  8753  8761  8779  8783  8803  8807  8819  8821  8831  8837  8839  8849  8861  8863  8867  8887  8893  8923  8929  8933  8941  8951  8963  8969  8971  8999  9001  9007  9011  9013  9029  9041  9043  9049  9059  9067  9091  9103  9109  9127  9133  9137  9151  9157  9161  9173  9181  9187  9199  9203  9209  9221  9227  9239  9241  9257  9277  9281  9283  9293  9311  9319  9323  9337  9341  9343  9349  9371  9377  9391  9397  9403  9413  9419  9421  9431  9433  9437  9439  9461  9463  9467  9473  9479  9491  9497  9511  9521  9533  9539  9547  9551  9587  9601  9613  9619  9623  9629  9631  9643  9649  9661  9677  9679  9689  9697  9719  9721  9733  9739  9743  9749  9767  9769  9781  9787  9791  9803  9811  9817  9829  9833  9839  9851  9857  9859  9871  9883  9887  9901  9907  9923  9929  9931  9941  9949  9967  9973  10007  10009  10037  10039  10061  10067  10069  10079  10091  10093  10099  10103  10111  10133  10139  10141  10151  10159  10163  10169  10177  10181  10193  10211  10223  10243  10247  10253  10259  10267  10271  10273  10289  10301  10303  10313  10321  10331  10333  10337  10343  10357  10369  10391  10399  10427  10429  10433  10453  10457  10459  10463  10477  10487  10499  10501  10513  10529  10531  10559  10567  10589  10597  10601  10607  10613  10627  10631  10639  10651  10657  10663  10667  10687  10691  10709  10711  10723  10729  10733  10739  10753  10771  10781  10789  10799  10831  10837  10847  10853  10859  10861  10867  10883  10889  10891  10903  10909  10937  10939  10949  10957  10973  10979  10987  10993  11003  11027  11047  11057  11059  11069  11071  11083  11087  11093  11113  11117  11119  11131  11149  11159  11161  11171  11173  11177  11197  11213  11239  11243  11251  11257  11261  11273  11279  11287  11299  11311  11317  11321  11329  11351  11353  11369  11383  11393  11399  11411  11423  11437  11443  11447  11467  11471  11483  11489  11491  11497  11503  11519  11527  11549  11551  11579  11587  11593  11597  11617  11621  11633  11657  11677  11681  11689  11699  11701  11717  11719  11731  11743  11777  11779  11783  11789  11801  11807  11813  11821  11827  11831  11833  11839  11863  11867  11887  11897  11903  11909  11923  11927  11933  11939  11941  11953  11959  11969  11971  11981  11987  12007  12011  12037  12041  12043  12049  12071  12073  12097  12101  12107  12109  12113  12119  12143  12149  12157  12161  12163  12197  12203  12211  12227  12239  12241  12251  12253  12263  12269  12277  12281  12289  12301  12323  12329  12343  12347  12373  12377  12379  12391  12401  12409  12413  12421  12433  12437  12451  12457  12473  12479  12487  12491  12497  12503  12511  12517  12527  12539  12541  12547  12553  12569  12577  12583  12589  12601  12611  12613  12619  12637  12641  12647  12653  12659  12671  12689  12697  12703  12713  12721  12739  12743  12757  12763  12781  12791  12799  12809  12821  12823  12829  12841  12853  12889  12893  12899  12907  12911  12917  12919  12923  12941  12953  12959  12967  12973  12979  12983  13001  13003  13007  13009  13033  13037  13043  13049  13063  13093  13099  13103  13109  13121  13127  13147  13151  13159  13163  13171  13177  13183  13187  13217  13219  13229  13241  13249  13259  13267  13291  13297  13309  13313  13327  13331  13337  13339  13367  13381  13397  13399  13411  13417  13421  13441  13451  13457  13463  13469  13477  13487  13499  13513  13523  13537  13553  13567  13577  13591  13597  13613  13619  13627  13633  13649  13669  13679  13681  13687  13691  13693  13697  13709  13711  13721  13723  13729  13751  13757  13759  13763  13781  13789  13799  13807  13829  13831  13841  13859  13873  13877  13879  13883  13901  13903  13907  13913  13921  13931  13933  13963  13967  13997  13999  14009  14011  14029  14033  14051  14057  14071  14081  14083  14087  14107  14143  14149  14153  14159  14173  14177  14197  14207  14221  14243  14249  14251  14281  14293  14303  14321  14323  14327  14341  14347  14369  14387  14389  14401  14407  14411  14419  14423  14431  14437  14447  14449  14461  14479  14489  14503  14519  14533  14537  14543  14549  14551  14557  14561  14563  14591  14593  14621  14627  14629  14633  14639  14653  14657  14669  14683  14699  14713  14717  14723  14731  14737  14741  14747  14753  14759  14767  14771  14779  14783  14797  14813  14821  14827  14831  14843  14851  14867  14869  14879  14887  14891  14897  14923  14929  14939  14947  14951  14957  14969  14983  15013  15017  15031  15053  15061  15073  15077  15083  15091  15101  15107  15121  15131  15137  15139  15149  15161  15173  15187  15193  15199  15217  15227  15233  15241  15259  15263  15269  15271  15277  15287  15289  15299  15307  15313  15319  15329  15331  15349  15359  15361  15373  15377  15383  15391  15401  15413  15427  15439  15443  15451  15461  15467  15473  15493  15497  15511  15527  15541  15551  15559  15569  15581  15583  15601  15607  15619  15629  15641  15643  15647  15649  15661  15667  15671  15679  15683  15727  15731  15733  15737  15739  15749  15761  15767  15773  15787  15791  15797  15803  15809  15817  15823  15859  15877  15881  15887  15889  15901  15907  15913  15919  15923  15937  15959  15971  15973  15991  16001  16007  16033  16057  16061  16063  16067  16069  16073  16087  16091  16097  16103  16111  16127  16139  16141  16183  16187  16189  16193  16217  16223  16229  16231  16249  16253  16267  16273  16301  16319  16333  16339  16349  16361  16363  16369  16381  16411  16417  16421  16427  16433  16447  16451  16453  16477  16481  16487  16493  16519  16529  16547  16553  16561  16567  16573  16603  16607  16619  16631  16633  16649  16651  16657  16661  16673  16691  16693  16699  16703  16729  16741  16747  16759  16763  16787  16811  16823  16829  16831  16843  16871  16879  16883  16889  16901  16903  16921  16927  16931  16937  16943  16963  16979  16981  16987  16993  17011  17021  17027  17029  17033  17041  17047  17053  17077  17093  17099  17107  17117  17123  17137  17159  17167  17183  17189  17191  17203  17207  17209  17231  17239  17257  17291  17293  17299  17317  17321  17327  17333  17341  17351  17359  17377  17383  17387  17389  17393  17401  17417  17419  17431  17443  17449  17467  17471  17477  17483  17489  17491  17497  17509  17519  17539  17551  17569  17573  17579  17581  17597  17599  17609  17623  17627  17657  17659  17669  17681  17683  17707  17713  17729  17737  17747  17749  17761  17783  17789  17791  17807  17827  17837  17839  17851  17863  17881  17891  17903  17909  17911  17921  17923  17929  17939  17957  17959  17971  17977  17981  17987  17989  18013  18041  18043  18047  18049  18059  18061  18077  18089  18097  18119  18121  18127  18131  18133  18143  18149  18169  18181  18191  18199  18211  18217  18223  18229  18233  18251  18253  18257  18269  18287  18289  18301  18307  18311  18313  18329  18341  18353  18367  18371  18379  18397  18401  18413  18427  18433  18439  18443  18451  18457  18461  18481  18493  18503  18517  18521  18523  18539  18541  18553  18583  18587  18593  18617  18637  18661  18671  18679  18691  18701  18713  18719  18731  18743  18749  18757  18773  18787  18793  18797  18803  18839  18859  18869  18899  18911  18913  18917  18919  18947  18959  18973  18979  19001  19009  19013  19031  19037  19051  19069  19073  19079  19081  19087  19121  19139  19141  19157  19163  19181  19183  19207  19211  19213  19219  19231  19237  19249  19259  19267  19273  19289  19301  19309  19319  19333  19373  19379  19381  19387  19391  19403  19417  19421  19423  19427  19429  19433  19441  19447  19457  19463  19469  19471  19477  19483  19489  19501  19507  19531  19541  19543  19553  19559  19571  19577  19583  19597  19603  19609  19661  19681  19687  19697  19699  19709  19717  19727  19739  19751  19753  19759  19763  19777  19793  19801  19813  19819  19841  19843  19853  19861  19867  19889  19891  19913  19919  19927  19937  19949  19961  19963  19973  19979  19991  19993  19997  20011  20021  20023  20029  20047  20051  20063  20071  20089  20101  20107  20113  20117  20123  20129  20143  20147  20149  20161  20173  20177  20183  20201  20219  20231  20233  20249  20261  20269  20287  20297  20323  20327  20333  20341  20347  20353  20357  20359  20369  20389  20393  20399  20407  20411  20431  20441  20443  20477  20479  20483  20507  20509  20521  20533  20543  20549  20551  20563  20593  20599  20611  20627  20639  20641  20663  20681  20693  20707  20717  20719  20731  20743  20747  20749  20753  20759  20771  20773  20789  20807  20809  20849  20857  20873  20879  20887  20897  20899  20903  20921  20929  20939  20947  20959  20963  20981  20983  21001  21011  21013  21017  21019  21023  21031  21059  21061  21067  21089  21101  21107  21121  21139  21143  21149  21157  21163  21169  21179  21187  21191  21193  21211  21221  21227  21247  21269  21277  21283  21313  21317  21319  21323  21341  21347  21377  21379  21383  21391  21397  21401  21407  21419  21433  21467  21481  21487  21491  21493  21499  21503  21517  21521  21523  21529  21557  21559  21563  21569  21577  21587  21589  21599  21601  21611  21613  21617  21647  21649  21661  21673  21683  21701  21713  21727  21737  21739  21751  21757  21767  21773  21787  21799  21803  21817  21821  21839  21841  21851  21859  21863  21871  21881  21893  21911  21929  21937  21943  21961  21977  21991  21997  22003  22013  22027  22031  22037  22039  22051  22063  22067  22073  22079  22091  22093  22109  22111  22123  22129  22133  22147  22153  22157  22159  22171  22189  22193  22229  22247  22259  22271  22273  22277  22279  22283  22291  22303  22307  22343  22349  22367  22369  22381  22391  22397  22409  22433  22441  22447  22453  22469  22481  22483  22501  22511  22531  22541  22543  22549  22567  22571  22573  22613  22619  22621  22637  22639  22643  22651  22669  22679  22691  22697  22699  22709  22717  22721  22727  22739  22741  22751  22769  22777  22783  22787  22807  22811  22817  22853  22859  22861  22871  22877  22901  22907  22921  22937  22943  22961  22963  22973  22993  23003  23011  23017  23021  23027  23029  23039  23041  23053  23057  23059  23063  23071  23081  23087  23099  23117  23131  23143  23159  23167  23173  23189  23197  23201  23203  23209  23227  23251  23269  23279  23291  23293  23297  23311  23321  23327  23333  23339  23357  23369  23371  23399  23417  23431  23447  23459  23473  23497  23509  23531  23537  23539  23549  23557  23561  23563  23567  23581  23593  23599  23603  23609  23623  23627  23629  23633  23663  23669  23671  23677  23687  23689  23719  23741  23743  23747  23753  23761  23767  23773  23789  23801  23813  23819  23827  23831  23833  23857  23869  23873  23879  23887  23893  23899  23909  23911  23917  23929  23957  23971  23977  23981  23993  24001  24007  24019  24023  24029  24043  24049  24061  24071  24077  24083  24091  24097  24103  24107  24109  24113  24121  24133  24137  24151  24169  24179  24181  24197  24203  24223  24229  24239  24247  24251  24281  24317  24329  24337  24359  24371  24373  24379  24391  24407  24413  24419  24421  24439  24443  24469  24473  24481  24499  24509  24517  24527  24533  24547  24551  24571  24593  24611  24623  24631  24659  24671  24677  24683  24691  24697  24709  24733  24749  24763  24767  24781  24793  24799  24809  24821  24841  24847  24851  24859  24877  24889  24907  24917  24919  24923  24943  24953  24967  24971  24977  24979  24989  25013  25031  25033  25037  25057  25073  25087  25097  25111  25117  25121  25127  25147  25153  25163  25169  25171  25183  25189  25219  25229  25237  25243  25247  25253  25261  25301  25303  25307  25309  25321  25339  25343  25349  25357  25367  25373  25391  25409  25411  25423  25439  25447  25453  25457  25463  25469  25471  25523  25537  25541  25561  25577  25579  25583  25589  25601  25603  25609  25621  25633  25639  25643  25657  25667  25673  25679  25693  25703  25717  25733  25741  25747  25759  25763  25771  25793  25799  25801  25819  25841  25847  25849  25867  25873  25889  25903  25913  25919  25931  25933  25939  25943  25951  25969  25981  25997  25999  26003  26017  26021  26029  26041  26053  26083  26099  26107  26111  26113  26119  26141  26153  26161  26171  26177  26183  26189  26203  26209  26227  26237  26249  26251  26261  26263  26267  26293  26297  26309  26317  26321  26339  26347  26357  26371  26387  26393  26399  26407  26417  26423  26431  26437  26449  26459  26479  26489  26497  26501  26513  26539  26557  26561  26573  26591  26597  26627  26633  26641  26647  26669  26681  26683  26687  26693  26699  26701  26711  26713  26717  26723  26729  26731  26737  26759  26777  26783  26801  26813  26821  26833  26839  26849  26861  26863  26879  26881  26891  26893  26903  26921  26927  26947  26951  26953  26959  26981  26987  26993  27011  27017  27031  27043  27059  27061  27067  27073  27077  27091  27103  27107  27109  27127  27143  27179  27191  27197  27211  27239  27241  27253  27259  27271  27277  27281  27283  27299  27329  27337  27361  27367  27397  27407  27409  27427  27431  27437  27449  27457  27479  27481  27487  27509  27527  27529  27539  27541  27551  27581  27583  27611  27617  27631  27647  27653  27673  27689  27691  27697  27701  27733  27737  27739  27743  27749  27751  27763  27767  27773  27779  27791  27793  27799  27803  27809  27817  27823  27827  27847  27851  27883  27893  27901  27917  27919  27941  27943  27947  27953  27961  27967  27983  27997  28001  28019  28027  28031  28051  28057  28069  28081  28087  28097  28099  28109  28111  28123  28151  28163  28181  28183  28201  28211  28219  28229  28277  28279  28283  28289  28297  28307  28309  28319  28349  28351  28387  28393  28403  28409  28411  28429  28433  28439  28447  28463  28477  28493  28499  28513  28517  28537  28541  28547  28549  28559  28571  28573  28579  28591  28597  28603  28607  28619  28621  28627  28631  28643  28649  28657  28661  28663  28669  28687  28697  28703  28711  28723  28729  28751  28753  28759  28771  28789  28793  28807  28813  28817  28837  28843  28859  28867  28871  28879  28901  28909  28921  28927  28933  28949  28961  28979  29009  29017  29021  29023  29027  29033  29059  29063  29077  29101  29123  29129  29131  29137  29147  29153  29167  29173  29179  29191  29201  29207  29209  29221  29231  29243  29251  29269  29287  29297  29303  29311  29327  29333  29339  29347  29363  29383  29387  29389  29399  29401  29411  29423  29429  29437  29443  29453  29473  29483  29501  29527  29531  29537  29567  29569  29573  29581  29587  29599  29611  29629  29633  29641  29663  29669  29671  29683  29717  29723  29741  29753  29759  29761  29789  29803  29819  29833  29837  29851  29863  29867  29873  29879  29881  29917  29921  29927  29947  29959  29983  29989  30011  30013  30029  30047  30059  30071  30089  30091  30097  30103  30109  30113  30119  30133  30137  30139  30161  30169  30181  30187  30197  30203  30211  30223  30241  30253  30259  30269  30271  30293  30307  30313  30319  30323  30341  30347  30367  30389  30391  30403  30427  30431  30449  30467  30469  30491  30493  30497  30509  30517  30529  30539  30553  30557  30559  30577  30593  30631  30637  30643  30649  30661  30671  30677  30689  30697  30703  30707  30713  30727  30757  30763  30773  30781  30803  30809  30817  30829  30839  30841  30851  30853  30859  30869  30871  30881  30893  30911  30931  30937  30941  30949  30971  30977  30983  31013  31019  31033  31039  31051  31063  31069  31079  31081  31091  31121  31123  31139  31147  31151  31153  31159  31177  31181  31183  31189  31193  31219  31223  31231  31237  31247  31249  31253  31259  31267  31271  31277  31307  31319  31321  31327  31333  31337  31357  31379  31387  31391  31393  31397  31469  31477  31481  31489  31511  31513  31517  31531  31541  31543  31547  31567  31573  31583  31601  31607  31627  31643  31649  31657  31663  31667  31687  31699  31721  31723  31727  31729  31741  31751  31769  31771  31793  31799  31817  31847  31849  31859  31873  31883  31891  31907  31957  31963  31973  31981  31991  32003  32009  32027  32029  32051  32057  32059  32063  32069  32077  32083  32089  32099  32117  32119  32141  32143  32159  32173  32183  32189  32191  32203  32213  32233  32237  32251  32257  32261  32297  32299  32303  32309  32321  32323  32327  32341  32353  32359  32363  32369  32371  32377  32381  32401  32411  32413  32423  32429  32441  32443  32467  32479  32491  32497  32503  32507  32531  32533  32537  32561  32563  32569  32573  32579  32587  32603  32609  32611  32621  32633  32647  32653  32687  32693  32707  32713  32717  32719  32749  32771  32779  32783  32789  32797  32801  32803  32831  32833  32839  32843  32869  32887  32909  32911  32917  32933  32939  32941  32957  32969  32971  32983  32987  32993  32999  33013  33023  33029  33037  33049  33053  33071  33073  33083  33091  33107  33113  33119  33149  33151  33161  33179  33181  33191  33199  33203  33211  33223  33247  33287  33289  33301  33311  33317  33329  33331  33343  33347  33349  33353  33359  33377  33391  33403  33409  33413  33427  33457  33461  33469  33479  33487  33493  33503  33521  33529  33533  33547  33563  33569  33577  33581  33587  33589  33599  33601  33613  33617  33619  33623  33629  33637  33641  33647  33679  33703  33713  33721  33739  33749  33751  33757  33767  33769  33773  33791  33797  33809  33811  33827  33829  33851  33857  33863  33871  33889  33893  33911  33923  33931  33937  33941  33961  33967  33997  34019  34031  34033  34039  34057  34061  34123  34127  34129  34141  34147  34157  34159  34171  34183  34211  34213  34217  34231  34253  34259  34261  34267  34273  34283  34297  34301  34303  34313  34319  34327  34337  34351  34361  34367  34369  34381  34403  34421  34429  34439  34457  34469  34471  34483  34487  34499  34501  34511  34513  34519  34537  34543  34549  34583  34589  34591  34603  34607  34613  34631  34649  34651  34667  34673  34679  34687  34693  34703  34721  34729  34739  34747  34757  34759  34763  34781  34807  34819  34841  34843  34847  34849  34871  34877  34883  34897  34913  34919  34939  34949  34961  34963  34981  35023  35027  35051  35053  35059  35069  35081  35083  35089  35099  35107  35111  35117  35129  35141  35149  35153  35159  35171  35201  35221  35227  35251  35257  35267  35279  35281  35291  35311  35317  35323  35327  35339  35353  35363  35381  35393  35401  35407  35419  35423  35437  35447  35449  35461  35491  35507  35509  35521  35527  35531  35533  35537  35543  35569  35573  35591  35593  35597  35603  35617  35671  35677  35729  35731  35747  35753  35759  35771  35797  35801  35803  35809  35831  35837  35839  35851  35863  35869  35879  35897  35899  35911  35923  35933  35951  35963  35969  35977  35983  35993  35999  36007  36011  36013  36017  36037  36061  36067  36073  36083  36097  36107  36109  36131  36137  36151  36161  36187  36191  36209  36217  36229  36241  36251  36263  36269  36277  36293  36299  36307  36313  36319  36341  36343  36353  36373  36383  36389  36433  36451  36457  36467  36469  36473  36479  36493  36497  36523  36527  36529  36541  36551  36559  36563  36571  36583  36587  36599  36607  36629  36637  36643  36653  36671  36677  36683  36691  36697  36709  36713  36721  36739  36749  36761  36767  36779  36781  36787  36791  36793  36809  36821  36833  36847  36857  36871  36877  36887  36899  36901  36913  36919  36923  36929  36931  36943  36947  36973  36979  36997  37003  37013  37019  37021  37039  37049  37057  37061  37087  37097  37117  37123  37139  37159  37171  37181  37189  37199  37201  37217  37223  37243  37253  37273  37277  37307  37309  37313  37321  37337  37339  37357  37361  37363  37369  37379  37397  37409  37423  37441  37447  37463  37483  37489  37493  37501  37507  37511  37517  37529  37537  37547  37549  37561  37567  37571  37573  37579  37589  37591  37607  37619  37633  37643  37649  37657  37663  37691  37693  37699  37717  37747  37781  37783  37799  37811  37813  37831  37847  37853  37861  37871  37879  37889  37897  37907  37951  37957  37963  37967  37987  37991  37993  37997  38011  38039  38047  38053  38069  38083  38113  38119  38149  38153  38167  38177  38183  38189  38197  38201  38219  38231  38237  38239  38261  38273  38281  38287  38299  38303  38317  38321  38327  38329  38333  38351  38371  38377  38393  38431  38447  38449  38453  38459  38461  38501  38543  38557  38561  38567  38569  38593  38603  38609  38611  38629  38639  38651  38653  38669  38671  38677  38693  38699  38707  38711  38713  38723  38729  38737  38747  38749  38767  38783  38791  38803  38821  38833  38839  38851  38861  38867  38873  38891  38903  38917  38921  38923  38933  38953  38959  38971  38977  38993  39019  39023  39041  39043  39047  39079  39089  39097  39103  39107  39113  39119  39133  39139  39157  39161  39163  39181  39191  39199  39209  39217  39227  39229  39233  39239  39241  39251  39293  39301  39313  39317  39323  39341  39343  39359  39367  39371  39373  39383  39397  39409  39419  39439  39443  39451  39461  39499  39503  39509  39511  39521  39541  39551  39563  39569  39581  39607  39619  39623  39631  39659  39667  39671  39679  39703  39709  39719  39727  39733  39749  39761  39769  39779  39791  39799  39821  39827  39829  39839  39841  39847  39857  39863  39869  39877  39883  39887  39901  39929  39937  39953  39971  39979  39983  39989  40009  40013  40031  40037  40039  40063  40087  40093  40099  40111  40123  40127  40129  40151  40153  40163  40169  40177  40189  40193  40213  40231  40237  40241  40253  40277  40283  40289  40343  40351  40357  40361  40387  40423  40427  40429  40433  40459  40471  40483  40487  40493  40499  40507  40519  40529  40531  40543  40559  40577  40583  40591  40597  40609  40627  40637  40639  40693  40697  40699  40709  40739  40751  40759  40763  40771  40787  40801  40813  40819  40823  40829  40841  40847  40849  40853  40867  40879  40883  40897  40903  40927  40933  40939  40949  40961  40973  40993  41011  41017  41023  41039  41047  41051  41057  41077  41081  41113  41117  41131  41141  41143  41149  41161  41177  41179  41183  41189  41201  41203  41213  41221  41227  41231  41233  41243  41257  41263  41269  41281  41299  41333  41341  41351  41357  41381  41387  41389  41399  41411  41413  41443  41453  41467  41479  41491  41507  41513  41519  41521  41539  41543  41549  41579  41593  41597  41603  41609  41611  41617  41621  41627  41641  41647  41651  41659  41669  41681  41687  41719  41729  41737  41759  41761  41771  41777  41801  41809  41813  41843  41849  41851  41863  41879  41887  41893  41897  41903  41911  41927  41941  41947  41953  41957  41959  41969  41981  41983  41999  42013  42017  42019  42023  42043  42061  42071  42073  42083  42089  42101  42131  42139  42157  42169  42179  42181  42187  42193  42197  42209  42221  42223  42227  42239  42257  42281  42283  42293  42299  42307  42323  42331  42337  42349  42359  42373  42379  42391  42397  42403  42407  42409  42433  42437  42443  42451  42457  42461  42463  42467  42473  42487  42491  42499  42509  42533  42557  42569  42571  42577  42589  42611  42641  42643  42649  42667  42677  42683  42689  42697  42701  42703  42709  42719  42727  42737  42743  42751  42767  42773  42787  42793  42797  42821  42829  42839  42841  42853  42859  42863  42899  42901  42923  42929  42937  42943  42953  42961  42967  42979  42989  43003  43013  43019  43037  43049  43051  43063  43067  43093  43103  43117  43133  43151  43159  43177  43189  43201  43207  43223  43237  43261  43271  43283  43291  43313  43319  43321  43331  43391  43397  43399  43403  43411  43427  43441  43451  43457  43481  43487  43499  43517  43541  43543  43573  43577  43579  43591  43597  43607  43609  43613  43627  43633  43649  43651  43661  43669  43691  43711  43717  43721  43753  43759  43777  43781  43783  43787  43789  43793  43801  43853  43867  43889  43891  43913  43933  43943  43951  43961  43963  43969  43973  43987  43991  43997  44017  44021  44027  44029  44041  44053  44059  44071  44087  44089  44101  44111  44119  44123  44129  44131  44159  44171  44179  44189  44201  44203  44207  44221  44249  44257  44263  44267  44269  44273  44279  44281  44293  44351  44357  44371  44381  44383  44389  44417  44449  44453  44483  44491  44497  44501  44507  44519  44531  44533  44537  44543  44549  44563  44579  44587  44617  44621  44623  44633  44641  44647  44651  44657  44683  44687  44699  44701  44711  44729  44741  44753  44771  44773  44777  44789  44797  44809  44819  44839  44843  44851  44867  44879  44887  44893  44909  44917  44927  44939  44953  44959  44963  44971  44983  44987  45007  45013  45053  45061  45077  45083  45119  45121  45127  45131  45137  45139  45161  45179  45181  45191  45197  45233  45247  45259  45263  45281  45289  45293  45307  45317  45319  45329  45337  45341  45343  45361  45377  45389  45403  45413  45427  45433  45439  45481  45491  45497  45503  45523  45533  45541  45553  45557  45569  45587  45589  45599  45613  45631  45641  45659  45667  45673  45677  45691  45697  45707  45737  45751  45757  45763  45767  45779  45817  45821  45823  45827  45833  45841  45853  45863  45869  45887  45893  45943  45949  45953  45959  45971  45979  45989  46021  46027  46049  46051  46061  46073  46091  46093  46099  46103  46133  46141  46147  46153  46171  46181  46183  46187  46199  46219  46229  46237  46261  46271  46273  46279  46301  46307  46309  46327  46337  46349  46351  46381  46399  46411  46439  46441  46447  46451  46457  46471  46477  46489  46499  46507  46511  46523  46549  46559  46567  46573  46589  46591  46601  46619  46633  46639  46643  46649  46663  46679  46681  46687  46691  46703  46723  46727  46747  46751  46757  46769  46771  46807  46811  46817  46819  46829  46831  46853  46861  46867  46877  46889  46901  46919  46933  46957  46993  46997  47017  47041  47051  47057  47059  47087  47093  47111  47119  47123  47129  47137  47143  47147  47149  47161  47189  47207  47221  47237  47251  47269  47279  47287  47293  47297  47303  47309  47317  47339  47351  47353  47363  47381  47387  47389  47407  47417  47419  47431  47441  47459  47491  47497  47501  47507  47513  47521  47527  47533  47543  47563  47569  47581  47591  47599  47609  47623  47629  47639  47653  47657  47659  47681  47699  47701  47711  47713  47717  47737  47741  47743  47777  47779  47791  47797  47807  47809  47819  47837  47843  47857  47869  47881  47903  47911  47917  47933  47939  47947  47951  47963  47969  47977  47981  48017  48023  48029  48049  48073  48079  48091  48109  48119  48121  48131  48157  48163  48179  48187  48193  48197  48221  48239  48247  48259  48271  48281  48299  48311  48313  48337  48341  48353  48371  48383  48397  48407  48409  48413  48437  48449  48463  48473  48479  48481  48487  48491  48497  48523  48527  48533  48539  48541  48563  48571  48589  48593  48611  48619  48623  48647  48649  48661  48673  48677  48679  48731  48733  48751  48757  48761  48767  48779  48781  48787  48799  48809  48817  48821  48823  48847  48857  48859  48869  48871  48883  48889  48907  48947  48953  48973  48989  48991  49003  49009  49019  49031  49033  49037  49043  49057  49069  49081  49103  49109  49117  49121  49123  49139  49157  49169  49171  49177  49193  49199  49201  49207  49211  49223  49253  49261  49277  49279  49297  49307  49331  49333  49339  49363  49367  49369  49391  49393  49409  49411  49417  49429  49433  49451  49459  49463  49477  49481  49499  49523  49529  49531  49537  49547  49549  49559  49597  49603  49613  49627  49633  49639  49663  49667  49669  49681  49697  49711  49727  49739  49741  49747  49757  49783  49787  49789  49801  49807  49811  49823  49831  49843  49853  49871  49877  49891  49919  49921  49927  49937  49939  49943  49957  49991  49993  49999  50021  50023  50033  50047  50051  50053  50069  50077  50087  50093  50101  50111  50119  50123  50129  50131  50147  50153  50159  50177  50207  50221  50227  50231  50261  50263  50273  50287  50291  50311  50321  50329  50333  50341  50359  50363  50377  50383  50387  50411  50417  50423  50441  50459  50461  50497  50503  50513  50527  50539  50543  50549  50551  50581  50587  50591  50593  50599  50627  50647  50651  50671  50683  50707  50723  50741  50753  50767  50773  50777  50789  50821  50833  50839  50849  50857  50867  50873  50891  50893  50909  50923  50929  50951  50957  50969  50971  50989  50993  51001  51031  51043  51047  51059  51061  51071  51109  51131  51133  51137  51151  51157  51169  51193  51197  51199  51203  51217  51229  51239  51241  51257  51263  51283  51287  51307  51329  51341  51343  51347  51349  51361  51383  51407  51413  51419  51421  51427  51431  51437  51439  51449  51461  51473  51479  51481  51487  51503  51511  51517  51521  51539  51551  51563  51577  51581  51593  51599  51607  51613  51631  51637  51647  51659  51673  51679  51683  51691  51713  51719  51721  51749  51767  51769  51787  51797  51803  51817  51827  51829  51839  51853  51859  51869  51871  51893  51899  51907  51913  51929  51941  51949  51971  51973  51977  51991  52009  52021  52027  52051  52057  52067  52069  52081  52103  52121  52127  52147  52153  52163  52177  52181  52183  52189  52201  52223  52237  52249  52253  52259  52267  52289  52291  52301  52313  52321  52361  52363  52369  52379  52387  52391  52433  52453  52457  52489  52501  52511  52517  52529  52541  52543  52553  52561  52567  52571  52579  52583  52609  52627  52631  52639  52667  52673  52691  52697  52709  52711  52721  52727  52733  52747  52757  52769  52783  52807  52813  52817  52837  52859  52861  52879  52883  52889  52901  52903  52919  52937  52951  52957  52963  52967  52973  52981  52999  53003  53017  53047  53051  53069  53077  53087  53089  53093  53101  53113  53117  53129  53147  53149  53161  53171  53173  53189  53197  53201  53231  53233  53239  53267  53269  53279  53281  53299  53309  53323  53327  53353  53359  53377  53381  53401  53407  53411  53419  53437  53441  53453  53479  53503  53507  53527  53549  53551  53569  53591  53593  53597  53609  53611  53617  53623  53629  53633  53639  53653  53657  53681  53693  53699  53717  53719  53731  53759  53773  53777  53783  53791  53813  53819  53831  53849  53857  53861  53881  53887  53891  53897  53899  53917  53923  53927  53939  53951  53959  53987  53993  54001  54011  54013  54037  54049  54059  54083  54091  54101  54121  54133  54139  54151  54163  54167  54181  54193  54217  54251  54269  54277  54287  54293  54311  54319  54323  54331  54347  54361  54367  54371  54377  54401  54403  54409  54413  54419  54421  54437  54443  54449  54469  54493  54497  54499  54503  54517  54521  54539  54541  54547  54559  54563  54577  54581  54583  54601  54617  54623  54629  54631  54647  54667  54673  54679  54709  54713  54721  54727  54751  54767  54773  54779  54787  54799  54829  54833  54851  54869  54877  54881  54907  54917  54919  54941  54949  54959  54973  54979  54983  55001  55009  55021  55049  55051  55057  55061  55073  55079  55103  55109  55117  55127  55147  55163  55171  55201  55207  55213  55217  55219  55229  55243  55249  55259  55291  55313  55331  55333  55337  55339  55343  55351  55373  55381  55399  55411  55439  55441  55457  55469  55487  55501  55511  55529  55541  55547  55579  55589  55603  55609  55619  55621  55631  55633  55639  55661  55663  55667  55673  55681  55691  55697  55711  55717  55721  55733  55763  55787  55793  55799  55807  55813  55817  55819  55823  55829  55837  55843  55849  55871  55889  55897  55901  55903  55921  55927  55931  55933  55949  55967  55987  55997  56003  56009  56039  56041  56053  56081  56087  56093  56099  56101  56113  56123  56131  56149  56167  56171  56179  56197  56207  56209  56237  56239  56249  56263  56267  56269  56299  56311  56333  56359  56369  56377  56383  56393  56401  56417  56431  56437  56443  56453  56467  56473  56477  56479  56489  56501  56503  56509  56519  56527  56531  56533  56543  56569  56591  56597  56599  56611  56629  56633  56659  56663  56671  56681  56687  56701  56711  56713  56731  56737  56747  56767  56773  56779  56783  56807  56809  56813  56821  56827  56843  56857  56873  56891  56893  56897  56909  56911  56921  56923  56929  56941  56951  56957  56963  56983  56989  56993  56999  57037  57041  57047  57059  57073  57077  57089  57097  57107  57119  57131  57139  57143  57149  57163  57173  57179  57191  57193  57203  57221  57223  57241  57251  57259  57269  57271  57283  57287  57301  57329  57331  57347  57349  57367  57373  57383  57389  57397  57413  57427  57457  57467  57487  57493  57503  57527  57529  57557  57559  57571  57587  57593  57601  57637  57641  57649  57653  57667  57679  57689  57697  57709  57713  57719  57727  57731  57737  57751  57773  57781  57787  57791  57793  57803  57809  57829  57839  57847  57853  57859  57881  57899  57901  57917  57923  57943  57947  57973  57977  57991  58013  58027  58031  58043  58049  58057  58061  58067  58073  58099  58109  58111  58129  58147  58151  58153  58169  58171  58189  58193  58199  58207  58211  58217  58229  58231  58237  58243  58271  58309  58313  58321  58337  58363  58367  58369  58379  58391  58393  58403  58411  58417  58427  58439  58441  58451  58453  58477  58481  58511  58537  58543  58549  58567  58573  58579  58601  58603  58613  58631  58657  58661  58679  58687  58693  58699  58711  58727  58733  58741  58757  58763  58771  58787  58789  58831  58889  58897  58901  58907  58909  58913  58921  58937  58943  58963  58967  58979  58991  58997  59009  59011  59021  59023  59029  59051  59053  59063  59069  59077  59083  59093  59107  59113  59119  59123  59141  59149  59159  59167  59183  59197  59207  59209  59219  59221  59233  59239  59243  59263  59273  59281  59333  59341  59351  59357  59359  59369  59377  59387  59393  59399  59407  59417  59419  59441  59443  59447  59453  59467  59471  59473  59497  59509  59513  59539  59557  59561  59567  59581  59611  59617  59621  59627  59629  59651  59659  59663  59669  59671  59693  59699  59707  59723  59729  59743  59747  59753  59771  59779  59791  59797  59809  59833  59863  59879  59887  59921  59929  59951  59957  59971  59981  59999  60013  60017  60029  60037  60041  60077  60083  60089  60091  60101  60103  60107  60127  60133  60139  60149  60161  60167  60169  60209  60217  60223  60251  60257  60259  60271  60289  60293  60317  60331  60337  60343  60353  60373  60383  60397  60413  60427  60443  60449  60457  60493  60497  60509  60521  60527  60539  60589  60601  60607  60611  60617  60623  60631  60637  60647  60649  60659  60661  60679  60689  60703  60719  60727  60733  60737  60757  60761  60763  60773  60779  60793  60811  60821  60859  60869  60887  60889  60899  60901  60913  60917  60919  60923  60937  60943  60953  60961  61001  61007  61027  61031  61043  61051  61057  61091  61099  61121  61129  61141  61151  61153  61169  61211  61223  61231  61253  61261  61283  61291  61297  61331  61333  61339  61343  61357  61363  61379  61381  61403  61409  61417  61441  61463  61469  61471  61483  61487  61493  61507  61511  61519  61543  61547  61553  61559  61561  61583  61603  61609  61613  61627  61631  61637  61643  61651  61657  61667  61673  61681  61687  61703  61717  61723  61729  61751  61757  61781  61813  61819  61837  61843  61861  61871  61879  61909  61927  61933  61949  61961  61967  61979  61981  61987  61991  62003  62011  62017  62039  62047  62053  62057  62071  62081  62099  62119  62129  62131  62137  62141  62143  62171  62189  62191  62201  62207  62213  62219  62233  62273  62297  62299  62303  62311  62323  62327  62347  62351  62383  62401  62417  62423  62459  62467  62473  62477  62483  62497  62501  62507  62533  62539  62549  62563  62581  62591  62597  62603  62617  62627  62633  62639  62653  62659  62683  62687  62701  62723  62731  62743  62753  62761  62773  62791  62801  62819  62827  62851  62861  62869  62873  62897  62903  62921  62927  62929  62939  62969  62971  62981  62983  62987  62989  63029  63031  63059  63067  63073  63079  63097  63103  63113  63127  63131  63149  63179  63197  63199  63211  63241  63247  63277  63281  63299  63311  63313  63317  63331  63337  63347  63353  63361  63367  63377  63389  63391  63397  63409  63419  63421  63439  63443  63463  63467  63473  63487  63493  63499  63521  63527  63533  63541  63559  63577  63587  63589  63599  63601  63607  63611  63617  63629  63647  63649  63659  63667  63671  63689  63691  63697  63703  63709  63719  63727  63737  63743  63761  63773  63781  63793  63799  63803  63809  63823  63839  63841  63853  63857  63863  63901  63907  63913  63929  63949  63977  63997  64007  64013  64019  64033  64037  64063  64067  64081  64091  64109  64123  64151  64153  64157  64171  64187  64189  64217  64223  64231  64237  64271  64279  64283  64301  64303  64319  64327  64333  64373  64381  64399  64403  64433  64439  64451  64453  64483  64489  64499  64513  64553  64567  64577  64579  64591  64601  64609  64613  64621  64627  64633  64661  64663  64667  64679  64693  64709  64717  64747  64763  64781  64783  64793  64811  64817  64849  64853  64871  64877  64879  64891  64901  64919  64921  64927  64937  64951  64969  64997  65003  65011  65027  65029  65033  65053  65063  65071  65089  65099  65101  65111  65119  65123  65129  65141  65147  65167  65171  65173  65179  65183  65203  65213  65239  65257  65267  65269  65287  65293  65309  65323  65327  65353  65357  65371  65381  65393  65407  65413  65419  65423  65437  65447  65449  65479  65497  65519  65521  65537  65539  65543  65551  65557  65563  65579  65581  65587  65599  65609  65617  65629  65633  65647  65651  65657  65677  65687  65699  65701  65707  65713  65717  65719  65729  65731  65761  65777  65789  65809  65827  65831  65837  65839  65843  65851  65867  65881  65899  65921  65927  65929  65951  65957  65963  65981  65983  65993  66029  66037  66041  66047  66067  66071  66083  66089  66103  66107  66109  66137  66161  66169  66173  66179  66191  66221  66239  66271  66293  66301  66337  66343  66347  66359  66361  66373  66377  66383  66403  66413  66431  66449  66457  66463  66467  66491  66499  66509  66523  66529  66533  66541  66553  66569  66571  66587  66593  66601  66617  66629  66643  66653  66683  66697  66701  66713  66721  66733  66739  66749  66751  66763  66791  66797  66809  66821  66841  66851  66853  66863  66877  66883  66889  66919  66923  66931  66943  66947  66949  66959  66973  66977  67003  67021  67033  67043  67049  67057  67061  67073  67079  67103  67121  67129  67139  67141  67153  67157  67169  67181  67187  67189  67211  67213  67217  67219  67231  67247  67261  67271  67273  67289  67307  67339  67343  67349  67369  67391  67399  67409  67411  67421  67427  67429  67433  67447  67453  67477  67481  67489  67493  67499  67511  67523  67531  67537  67547  67559  67567  67577  67579  67589  67601  67607  67619  67631  67651  67679  67699  67709  67723  67733  67741  67751  67757  67759  67763  67777  67783  67789  67801  67807  67819  67829  67843  67853  67867  67883  67891  67901  67927  67931  67933  67939  67943  67957  67961  67967  67979  67987  67993  68023  68041  68053  68059  68071  68087  68099  68111  68113  68141  68147  68161  68171  68207  68209  68213  68219  68227  68239  68261  68279  68281  68311  68329  68351  68371  68389  68399  68437  68443  68447  68449  68473  68477  68483  68489  68491  68501  68507  68521  68531  68539  68543  68567  68581  68597  68611  68633  68639  68659  68669  68683  68687  68699  68711  68713  68729  68737  68743  68749  68767  68771  68777  68791  68813  68819  68821  68863  68879  68881  68891  68897  68899  68903  68909  68917  68927  68947  68963  68993  69001  69011  69019  69029  69031  69061  69067  69073  69109  69119  69127  69143  69149  69151  69163  69191  69193  69197  69203  69221  69233  69239  69247  69257  69259  69263  69313  69317  69337  69341  69371  69379  69383  69389  69401  69403  69427  69431  69439  69457  69463  69467  69473  69481  69491  69493  69497  69499  69539  69557  69593  69623  69653  69661  69677  69691  69697  69709  69737  69739  69761  69763  69767  69779  69809  69821  69827  69829  69833  69847  69857  69859  69877  69899  69911  69929  69931  69941  69959  69991  69997  70001  70003  70009  70019  70039  70051  70061  70067  70079  70099  70111  70117  70121  70123  70139  70141  70157  70163  70177  70181  70183  70199  70201  70207  70223  70229  70237  70241  70249  70271  70289  70297  70309  70313  70321  70327  70351  70373  70379  70381  70393  70423  70429  70439  70451  70457  70459  70481  70487  70489  70501  70507  70529  70537  70549  70571  70573  70583  70589  70607  70619  70621  70627  70639  70657  70663  70667  70687  70709  70717  70729  70753  70769  70783  70793  70823  70841  70843  70849  70853  70867  70877  70879  70891  70901  70913  70919  70921  70937  70949  70951  70957  70969  70979  70981  70991  70997  70999  71011  71023  71039  71059  71069  71081  71089  71119  71129  71143  71147  71153  71161  71167  71171  71191  71209  71233  71237  71249  71257  71261  71263  71287  71293  71317  71327  71329  71333  71339  71341  71347  71353  71359  71363  71387  71389  71399  71411  71413  71419  71429  71437  71443  71453  71471  71473  71479  71483  71503  71527  71537  71549  71551  71563  71569  71593  71597  71633  71647  71663  71671  71693  71699  71707  71711  71713  71719  71741  71761  71777  71789  71807  71809  71821  71837  71843  71849  71861  71867  71879  71881  71887  71899  71909  71917  71933  71941  71947  71963  71971  71983  71987  71993  71999  72019  72031  72043  72047  72053  72073  72077  72089  72091  72101  72103  72109  72139  72161  72167  72169  72173  72211  72221  72223  72227  72229  72251  72253  72269  72271  72277  72287  72307  72313  72337  72341  72353  72367  72379  72383  72421  72431  72461  72467  72469  72481  72493  72497  72503  72533  72547  72551  72559  72577  72613  72617  72623  72643  72647  72649  72661  72671  72673  72679  72689  72701  72707  72719  72727  72733  72739  72763  72767  72797  72817  72823  72859  72869  72871  72883  72889  72893  72901  72907  72911  72923  72931  72937  72949  72953  72959  72973  72977  72997  73009  73013  73019  73037  73039  73043  73061  73063  73079  73091  73121  73127  73133  73141  73181  73189  73237  73243  73259  73277  73291  73303  73309  73327  73331  73351  73361  73363  73369  73379  73387  73417  73421  73433  73453  73459  73471  73477  73483  73517  73523  73529  73547  73553  73561  73571  73583  73589  73597  73607  73609  73613  73637  73643  73651  73673  73679  73681  73693  73699  73709  73721  73727  73751  73757  73771  73783  73819  73823  73847  73849  73859  73867  73877  73883  73897  73907  73939  73943  73951  73961  73973  73999  74017  74021  74027  74047  74051  74071  74077  74093  74099  74101  74131  74143  74149  74159  74161  74167  74177  74189  74197  74201  74203  74209  74219  74231  74257  74279  74287  74293  74297  74311  74317  74323  74353  74357  74363  74377  74381  74383  74411  74413  74419  74441  74449  74453  74471  74489  74507  74509  74521  74527  74531  74551  74561  74567  74573  74587  74597  74609  74611  74623  74653  74687  74699  74707  74713  74717  74719  74729  74731  74747  74759  74761  74771  74779  74797  74821  74827  74831  74843  74857  74861  74869  74873  74887  74891  74897  74903  74923  74929  74933  74941  74959  75011  75013  75017  75029  75037  75041  75079  75083  75109  75133  75149  75161  75167  75169  75181  75193  75209  75211  75217  75223  75227  75239  75253  75269  75277  75289  75307  75323  75329  75337  75347  75353  75367  75377  75389  75391  75401  75403  75407  75431  75437  75479  75503  75511  75521  75527  75533  75539  75541  75553  75557  75571  75577  75583  75611  75617  75619  75629  75641  75653  75659  75679  75683  75689  75703  75707  75709  75721  75731  75743  75767  75773  75781  75787  75793  75797  75821  75833  75853  75869  75883  75913  75931  75937  75941  75967  75979  75983  75989  75991  75997  76001  76003  76031  76039  76079  76081  76091  76099  76103  76123  76129  76147  76157  76159  76163  76207  76213  76231  76243  76249  76253  76259  76261  76283  76289  76303  76333  76343  76367  76369  76379  76387  76403  76421  76423  76441  76463  76471  76481  76487  76493  76507  76511  76519  76537  76541  76543  76561  76579  76597  76603  76607  76631  76649  76651  76667  76673  76679  76697  76717  76733  76753  76757  76771  76777  76781  76801  76819  76829  76831  76837  76847  76871  76873  76883  76907  76913  76919  76943  76949  76961  76963  76991  77003  77017  77023  77029  77041  77047  77069  77081  77093  77101  77137  77141  77153  77167  77171  77191  77201  77213  77237  77239  77243  77249  77261  77263  77267  77269  77279  77291  77317  77323  77339  77347  77351  77359  77369  77377  77383  77417  77419  77431  77447  77471  77477  77479  77489  77491  77509  77513  77521  77527  77543  77549  77551  77557  77563  77569  77573  77587  77591  77611  77617  77621  77641  77647  77659  77681  77687  77689  77699  77711  77713  77719  77723  77731  77743  77747  77761  77773  77783  77797  77801  77813  77839  77849  77863  77867  77893  77899  77929  77933  77951  77969  77977  77983  77999  78007  78017  78031  78041  78049  78059  78079  78101  78121  78137  78139  78157  78163  78167  78173  78179  78191  78193  78203  78229  78233  78241  78259  78277  78283  78301  78307  78311  78317  78341  78347  78367  78401  78427  78437  78439  78467  78479  78487  78497  78509  78511  78517  78539  78541  78553  78569  78571  78577  78583  78593  78607  78623  78643  78649  78653  78691  78697  78707  78713  78721  78737  78779  78781  78787  78791  78797  78803  78809  78823  78839  78853  78857  78877  78887  78889  78893  78901  78919  78929  78941  78977  78979  78989  79031  79039  79043  79063  79087  79103  79111  79133  79139  79147  79151  79153  79159  79181  79187  79193  79201  79229  79231  79241  79259  79273  79279  79283  79301  79309  79319  79333  79337  79349  79357  79367  79379  79393  79397  79399  79411  79423  79427  79433  79451  79481  79493  79531  79537  79549  79559  79561  79579  79589  79601  79609  79613  79621  79627  79631  79633  79657  79669  79687  79691  79693  79697  79699  79757  79769  79777  79801  79811  79813  79817  79823  79829  79841  79843  79847  79861  79867  79873  79889  79901  79903  79907  79939  79943  79967  79973  79979  79987  79997  79999  80021  80039  80051  80071  80077  80107  80111  80141  80147  80149  80153  80167  80173  80177  80191  80207  80209  80221  80231  80233  80239  80251  80263  80273  80279  80287  80309  80317  80329  80341  80347  80363  80369  80387  80407  80429  80447  80449  80471  80473  80489  80491  80513  80527  80537  80557  80567  80599  80603  80611  80621  80627  80629  80651  80657  80669  80671  80677  80681  80683  80687  80701  80713  80737  80747  80749  80761  80777  80779  80783  80789  80803  80809  80819  80831  80833  80849  80863  80897  80909  80911  80917  80923  80929  80933  80953  80963  80989  81001  81013  81017  81019  81023  81031  81041  81043  81047  81049  81071  81077  81083  81097  81101  81119  81131  81157  81163  81173  81181  81197  81199  81203  81223  81233  81239  81281  81283  81293  81299  81307  81331  81343  81349  81353  81359  81371  81373  81401  81409  81421  81439  81457  81463  81509  81517  81527  81533  81547  81551  81553  81559  81563  81569  81611  81619  81629  81637  81647  81649  81667  81671  81677  81689  81701  81703  81707  81727  81737  81749  81761  81769  81773  81799  81817  81839  81847  81853  81869  81883  81899  81901  81919  81929  81931  81937  81943  81953  81967  81971  81973  82003  82007  82009  82013  82021  82031  82037  82039  82051  82067  82073  82129  82139  82141  82153  82163  82171  82183  82189  82193  82207  82217  82219  82223  82231  82237  82241  82261  82267  82279  82301  82307  82339  82349  82351  82361  82373  82387  82393  82421  82457  82463  82469  82471  82483  82487  82493  82499  82507  82529  82531  82549  82559  82561  82567  82571  82591  82601  82609  82613  82619  82633  82651  82657  82699  82721  82723  82727  82729  82757  82759  82763  82781  82787  82793  82799  82811  82813  82837  82847  82883  82889  82891  82903  82913  82939  82963  82981  82997  83003  83009  83023  83047  83059  83063  83071  83077  83089  83093  83101  83117  83137  83177  83203  83207  83219  83221  83227  83231  83233  83243  83257  83267  83269  83273  83299  83311  83339  83341  83357  83383  83389  83399  83401  83407  83417  83423  83431  83437  83443  83449  83459  83471  83477  83497  83537  83557  83561  83563  83579  83591  83597  83609  83617  83621  83639  83641  83653  83663  83689  83701  83717  83719  83737  83761  83773  83777  83791  83813  83833  83843  83857  83869  83873  83891  83903  83911  83921  83933  83939  83969  83983  83987  84011  84017  84047  84053  84059  84061  84067  84089  84121  84127  84131  84137  84143  84163  84179  84181  84191  84199  84211  84221  84223  84229  84239  84247  84263  84299  84307  84313  84317  84319  84347  84349  84377  84389  84391  84401  84407  84421  84431  84437  84443  84449  84457  84463  84467  84481  84499  84503  84509  84521  84523  84533  84551  84559  84589  84629  84631  84649  84653  84659  84673  84691  84697  84701  84713  84719  84731  84737  84751  84761  84787  84793  84809  84811  84827  84857  84859  84869  84871  84913  84919  84947  84961  84967  84977  84979  84991  85009  85021  85027  85037  85049  85061  85081  85087  85091  85093  85103  85109  85121  85133  85147  85159  85193  85199  85201  85213  85223  85229  85237  85243  85247  85259  85297  85303  85313  85331  85333  85361  85363  85369  85381  85411  85427  85429  85439  85447  85451  85453  85469  85487  85513  85517  85523  85531  85549  85571  85577  85597  85601  85607  85619  85621  85627  85639  85643  85661  85667  85669  85691  85703  85711  85717  85733  85751  85781  85793  85817  85819  85829  85831  85837  85843  85847  85853  85889  85903  85909  85931  85933  85991  85999  86011  86017  86027  86029  86069  86077  86083  86111  86113  86117  86131  86137  86143  86161  86171  86179  86183  86197  86201  86209  86239  86243  86249  86257  86263  86269  86287  86291  86293  86297  86311  86323  86341  86351  86353  86357  86369  86371  86381  86389  86399  86413  86423  86441  86453  86461  86467  86477  86491  86501  86509  86531  86533  86539  86561  86573  86579  86587  86599  86627  86629  86677  86689  86693  86711  86719  86729  86743  86753  86767  86771  86783  86813  86837  86843  86851  86857  86861  86869  86923  86927  86929  86939  86951  86959  86969  86981  86993  87011  87013  87037  87041  87049  87071  87083  87103  87107  87119  87121  87133  87149  87151  87179  87181  87187  87211  87221  87223  87251  87253  87257  87277  87281  87293  87299  87313  87317  87323  87337  87359  87383  87403  87407  87421  87427  87433  87443  87473  87481  87491  87509  87511  87517  87523  87539  87541  87547  87553  87557  87559  87583  87587  87589  87613  87623  87629  87631  87641  87643  87649  87671  87679  87683  87691  87697  87701  87719  87721  87739  87743  87751  87767  87793  87797  87803  87811  87833  87853  87869  87877  87881  87887  87911  87917  87931  87943  87959  87961  87973  87977  87991  88001  88003  88007  88019  88037  88069  88079  88093  88117  88129  88169  88177  88211  88223  88237  88241  88259  88261  88289  88301  88321  88327  88337  88339  88379  88397  88411  88423  88427  88463  88469  88471  88493  88499  88513  88523  88547  88589  88591  88607  88609  88643  88651  88657  88661  88663  88667  88681  88721  88729  88741  88747  88771  88789  88793  88799  88801  88807  88811  88813  88817  88819  88843  88853  88861  88867  88873  88883  88897  88903  88919  88937  88951  88969  88993  88997  89003  89009  89017  89021  89041  89051  89057  89069  89071  89083  89087  89101  89107  89113  89119  89123  89137  89153  89189  89203  89209  89213  89227  89231  89237  89261  89269  89273  89293  89303  89317  89329  89363  89371  89381  89387  89393  89399  89413  89417  89431  89443  89449  89459  89477  89491  89501  89513  89519  89521  89527  89533  89561  89563  89567  89591  89597  89599  89603  89611  89627  89633  89653  89657  89659  89669  89671  89681  89689  89753  89759  89767  89779  89783  89797  89809  89819  89821  89833  89839  89849  89867  89891  89897  89899  89909  89917  89923  89939  89959  89963  89977  89983  89989  90001  90007  90011  90017  90019  90023  90031  90053  90059  90067  90071  90073  90089  90107  90121  90127  90149  90163  90173  90187  90191  90197  90199  90203  90217  90227  90239  90247  90263  90271  90281  90289  90313  90353  90359  90371  90373  90379  90397  90401  90403  90407  90437  90439  90469  90473  90481  90499  90511  90523  90527  90529  90533  90547  90583  90599  90617  90619  90631  90641  90647  90659  90677  90679  90697  90703  90709  90731  90749  90787  90793  90803  90821  90823  90833  90841  90847  90863  90887  90901  90907  90911  90917  90931  90947  90971  90977  90989  90997  91009  91019  91033  91079  91081  91097  91099  91121  91127  91129  91139  91141  91151  91153  91159  91163  91183  91193  91199  91229  91237  91243  91249  91253  91283  91291  91297  91303  91309  91331  91367  91369  91373  91381  91387  91393  91397  91411  91423  91433  91453  91457  91459  91463  91493  91499  91513  91529  91541  91571  91573  91577  91583  91591  91621  91631  91639  91673  91691  91703  91711  91733  91753  91757  91771  91781  91801  91807  91811  91813  91823  91837  91841  91867  91873  91909  91921  91939  91943  91951  91957  91961  91967  91969  91997  92003  92009  92033  92041  92051  92077  92083  92107  92111  92119  92143  92153  92173  92177  92179  92189  92203  92219  92221  92227  92233  92237  92243  92251  92269  92297  92311  92317  92333  92347  92353  92357  92363  92369  92377  92381  92383  92387  92399  92401  92413  92419  92431  92459  92461  92467  92479  92489  92503  92507  92551  92557  92567  92569  92581  92593  92623  92627  92639  92641  92647  92657  92669  92671  92681  92683  92693  92699  92707  92717  92723  92737  92753  92761  92767  92779  92789  92791  92801  92809  92821  92831  92849  92857  92861  92863  92867  92893  92899  92921  92927  92941  92951  92957  92959  92987  92993  93001  93047  93053  93059  93077  93083  93089  93097  93103  93113  93131  93133  93139  93151  93169  93179  93187  93199  93229  93239  93241  93251  93253  93257  93263  93281  93283  93287  93307  93319  93323  93329  93337  93371  93377  93383  93407  93419  93427  93463  93479  93481  93487  93491  93493  93497  93503  93523  93529  93553  93557  93559  93563  93581  93601  93607  93629  93637  93683  93701  93703  93719  93739  93761  93763  93787  93809  93811  93827  93851  93871  93887  93889  93893  93901  93911  93913  93923  93937  93941  93949  93967  93971  93979  93983  93997  94007  94009  94033  94049  94057  94063  94079  94099  94109  94111  94117  94121  94151  94153  94169  94201  94207  94219  94229  94253  94261  94273  94291  94307  94309  94321  94327  94331  94343  94349  94351  94379  94397  94399  94421  94427  94433  94439  94441  94447  94463  94477  94483  94513  94529  94531  94541  94543  94547  94559  94561  94573  94583  94597  94603  94613  94621  94649  94651  94687  94693  94709  94723  94727  94747  94771  94777  94781  94789  94793  94811  94819  94823  94837  94841  94847  94849  94873  94889  94903  94907  94933  94949  94951  94961  94993  94999  95003  95009  95021  95027  95063  95071  95083  95087  95089  95093  95101  95107  95111  95131  95143  95153  95177  95189  95191  95203  95213  95219  95231  95233  95239  95257  95261  95267  95273  95279  95287  95311  95317  95327  95339  95369  95383  95393  95401  95413  95419  95429  95441  95443  95461  95467  95471  95479  95483  95507  95527  95531  95539  95549  95561  95569  95581  95597  95603  95617  95621  95629  95633  95651  95701  95707  95713  95717  95723  95731  95737  95747  95773  95783  95789  95791  95801  95803  95813  95819  95857  95869  95873  95881  95891  95911  95917  95923  95929  95947  95957  95959  95971  95987  95989  96001  96013  96017  96043  96053  96059  96079  96097  96137  96149  96157  96167  96179  96181  96199  96211  96221  96223  96233  96259  96263  96269  96281  96289  96293  96323  96329  96331  96337  96353  96377  96401  96419  96431  96443  96451  96457  96461  96469  96479  96487  96493  96497  96517  96527  96553  96557  96581  96587  96589  96601  96643  96661  96667  96671  96697  96703  96731  96737  96739  96749  96757  96763  96769  96779  96787  96797  96799  96821  96823  96827  96847  96851  96857  96893  96907  96911  96931  96953  96959  96973  96979  96989  96997  97001  97003  97007  97021  97039  97073  97081  97103  97117  97127  97151  97157  97159  97169  97171  97177  97187  97213  97231  97241  97259  97283  97301  97303  97327  97367  97369  97373  97379  97381  97387  97397  97423  97429  97441  97453  97459  97463  97499  97501  97511  97523  97547  97549  97553  97561  97571  97577  97579  97583  97607  97609  97613  97649  97651  97673  97687  97711  97729  97771  97777  97787  97789  97813  97829  97841  97843  97847  97849  97859  97861  97871  97879  97883  97919  97927  97931  97943  97961  97967  97973  97987  98009  98011  98017  98041  98047  98057  98081  98101  98123  98129  98143  98179  98207  98213  98221  98227  98251  98257  98269  98297  98299  98317  98321  98323  98327  98347  98369  98377  98387  98389  98407  98411  98419  98429  98443  98453  98459  98467  98473  98479  98491  98507  98519  98533  98543  98561  98563  98573  98597  98621  98627  98639  98641  98663  98669  98689  98711  98713  98717  98729  98731  98737  98773  98779  98801  98807  98809  98837  98849  98867  98869  98873  98887  98893  98897  98899  98909  98911  98927  98929  98939  98947  98953  98963  98981  98993  98999  99013  99017  99023  99041  99053  99079  99083  99089  99103  99109  99119  99131  99133  99137  99139  99149  99173  99181  99191  99223  99233  99241  99251  99257  99259  99277  99289  99317  99347  99349  99367  99371  99377  99391  99397  99401  99409  99431  99439  99469  99487  99497  99523  99527  99529  99551  99559  99563  99571  99577  99581  99607  99611  99623  99643  99661  99667  99679  99689  99707  99709  99713  99719  99721  99733  99761  99767  99787  99793  99809  99817  99823  99829  99833  99839  99859  99871  99877  99881  99901  99907  99923  99929  99961  99971  99989  99991

==== x1119_variable_names_and_data_type_52424 | variable_names_and_data_types-advanced | tutorial.txt line 52424 | expected: none
print (0.1 + 0.2) - 0.3

delay
---- output
 0

==== x1120_variable_names_and_data_type_52479 | variable_names_and_data_types-advanced | tutorial.txt line 52479 | expected: same
print pi + 1e53

delay
---- output
 100000000000000000000000000000000000000000000000000003.1415926535897932

==== x1121_variable_names_and_data_type_52498 | variable_names_and_data_types-advanced | tutorial.txt line 52498 | expected: same
print sqrt(2)

delay
---- output
 1.414213562373095

==== x1122_variable_names_and_data_type_52520 | variable_names_and_data_types-advanced | tutorial.txt line 52520 | expected: same
print 0.5 ^ 100
print 0.5 ^ -100
print 0.5 ^ -100 = 2 ^ 100

delay
---- output
 7.888609052210118054117285652827862296732064351090230047702789307e-31 
 1267650600228229401496703205376 
 1

==== x1123_variable_names_and_data_type_52542 | variable_names_and_data_types-advanced | tutorial.txt line 52542 | expected: same
x = pi ^ 30
print 1 / x
print 1 / 30
print 1 / 300000000
print 0.00000001 / 4

delay
---- output
 1.217597700325186743805050027998895815974103291905792193890430296e-15 
 0.0333333333333333 
 3.333333333333333333333333333333333333333333333333333333333333333e-9 
 0.0000000025

==== x1124_variable_names_and_data_type_52569 | variable_names_and_data_types-advanced | tutorial.txt line 52569 | expected: same
x = 1 / 3
print x / 700000000
print 1 / 2100000000
print divr(1, 3) / 700000000
print isrounded(x / 700000000)

delay
---- output
 4.761904761904761428571428571428571428571428571428571428571428571e-10 
 4.761904761904761904761904761904761904761904761904761904761904762e-10 
 4.761904761904761904761904761904761904761904761904761904761904762e-10 
 1

==== x1125_variable_names_and_data_type_52615 | variable_names_and_data_types-advanced | tutorial.txt line 52615 | expected: same
x = divr(1, 3)
y = x + x + x
print y
print 1 / 3 * 3

delay
---- output
 1 
 0.9999999999999999

==== x1126_variable_names_and_data_type_52636 | variable_names_and_data_types-advanced | tutorial.txt line 52636 | expected: same
x = divr(1, 3)
print fraction$(x + divr(1, 2))
print fraction$(x + 0.25)
print fraction$(divr(0.05, 12))
print divr(0.05, 12) * 12
print 0.05 / 12 * 12
print divr(1, 7) * 10 ^ 54 * 7

delay
---- output
5/6
7/12
1/240
 0.05 
 0.0500000000000004 
 1000000000000000000000000000000000000000000000000000000

==== x1127_variable_names_and_data_type_52669 | variable_names_and_data_types-advanced | tutorial.txt line 52669 | expected: same
rate = divr(0.05, 12)
print typeof$(rate * 7)
print typeof$(rate * 12)
print rate * 12
print fraction$(rate * 12)
print typeof$(divr(1, 3) + divr(1, 6))

delay
---- output
Name:*Literal*, Dtype:Real, *Rational* 7/240
Name:*Literal*, Dtype:Real, *Narrow*
 0.05 
1/20
Name:*Literal*, Dtype:Real, *Narrow*

==== x1128_variable_names_and_data_type_52697 | variable_names_and_data_types-advanced | tutorial.txt line 52697 | expected: same
x = divr(1, 3)
print x + 0.3333333333333333
print x = 0.3333333333333333
print fraction$(divr(1, 3) ^ 20)
print divr(1, 3) ^ 21
print divr(4, 3) ^ 166
print divr(4, 3) ^ 166 = 4 ^ 166 / 3 ^ 166

delay
---- output
 0.6666666666666666 
 1 
1/3486784401
 9.559906635974804377740857437469456355220551341835985612272828719e-11 
 549326154308536733621.4898728569424319 
 1

==== x1129_variable_names_and_data_type_52723 | variable_names_and_data_types-advanced | tutorial.txt line 52723 | expected: same
small = divr(1, 3) ^ 40
print small
print small = 1 / 3 ^ 40
print typeof$(small)
print divr(1, 4 * 10 ^ 16)
print isrounded(divr(1, 4 * 10 ^ 16))

delay
---- output
 8.225263339969959081282058400607250240380335470448824242293174741e-20 
 1 
Name:SMALL, Dtype:Real, *Sci*, *Rounded*
 2.5e-17 
 0

==== x1130_variable_names_and_data_type_52754 | variable_names_and_data_types-advanced | tutorial.txt line 52754 | expected: same
print fraction$(10 ^ 60)
print fraction$(divr(1, 3) ^ 40)
print denominator(divr(1, 3) ^ 40)
print fraction(divr(1, 3) ^ 40, 1000)

delay
---- output
1000000000000000000000000000000000000000000000000000000000000
8225263339969959081282058400607250240380335470448824242293174741/1e+83
 1e+83 
 0

==== x1131_variable_names_and_data_type_52855 | variable_names_and_data_types-advanced | tutorial.txt line 52855 | expected: same
smallest = val('1e-1000000000')
print smallest
print smallest / 10

delay
---- output
 1e-1000000000 
 0

==== x1133_variable_names_and_data_type_53024 | variable_names_and_data_types-advanced | tutorial.txt line 53024 | expected: none
print (0.1 + 0.2) - 0.3

delay
---- output
 0

==== x1135_variable_names_and_data_type_53040 | variable_names_and_data_types-advanced | tutorial.txt line 53040 | expected: none
0

delay
---- output


==== x1136_variable_names_and_data_type_53099 | variable_names_and_data_types-advanced | tutorial.txt line 53099 | expected: none
print divr(1, 3) * 3            !   1
print fraction$(divr(100, 3))   !  100/3

delay
---- output
 1 
100/3

==== x1137_variable_names_and_data_type_53140 | variable_names_and_data_types-advanced | tutorial.txt line 53140 | expected: same
third = 1 / 3
print typeof$(third)
print typeof$(sqrt(4))
print typeof$(sqrt(2))
y = round(1.2345, 3)
print typeof$(y)
print third = 0.3333333333333333

delay
---- output
Name:THIRD, Dtype:Real, *Narrow*, *Rounded*
Name:*Literal*, Dtype:Real, *Narrow*
Name:*Literal*, Dtype:Real, *Narrow*, *Rounded*
Name:Y, Dtype:Real, *Narrow*
 1

==== x1138_variable_names_and_data_type_53158 | variable_names_and_data_types-advanced | tutorial.txt line 53158 | expected: same
third = 1 / 3
dim v(*)
fill v with 0.5, third, 0.25
dim s(*)
s = sort(v)
print typeof$(s(1))
print typeof$(s(2))
print typeof$(stats$max(v))
fill v with 0.5, 0.75, 0.25
print typeof$(stats$max(v))
print typeof$((1 + 2i) / (3 + 4i))
print typeof$((1 + 2i) / (3 + 7i))
print typeof$(sqrt(-4 + 0i))
print typeof$(sqrt(-2 + 0i))

delay
---- output
Name:*Literal*, Dtype:Real, *Narrow*
Name:*Literal*, Dtype:Real, *Narrow*, *Rounded*
Name:*Literal*, Dtype:Real, *Narrow*, *Rounded*
Name:*Literal*, Dtype:Real, *Narrow*
Name:*Literal*, Dtype:Real, *Complex*
Name:*Literal*, Dtype:Real, *Complex*, *Rounded*
Name:*Literal*, Dtype:Real, *Complex*
Name:*Literal*, Dtype:Real, *Complex*, *Rounded*

==== x1139_variable_names_and_data_type_53197 | variable_names_and_data_types-advanced | tutorial.txt line 53197 | expected: same
third = 1 / 3
print isrounded(third), isrounded(0.05), isrounded(divr(1, 3))
dim v(*)
fill v with third, 0.5, 1 / 7, 0.25
print isrounded(v)
print stats$sum(isrounded(v))
print filter(v, not isrounded(v))
big = 1e63
print big
print big + 0.123
print isrounded(big), isrounded(big + 0.123)

delay
---- output
 1  0  0 
1  0  1  0
 2 
 0.5  0.25
 1000000000000000000000000000000000000000000000000000000000000000 
 1e+63 
 0  1

==== x1140_variable_names_and_data_type_53236 | variable_names_and_data_types-advanced | tutorial.txt line 53236 | expected: none
z = 3 + 4i
print z * (3 - 4i), abs(z), typeof$(z)   !   25+0i   5   Name:Z, Dtype:Real, *Complex*
print sqrt(-4 + 0i), conj(z)              !   0+2i   3-4i
print _inf - _inf, 1 / _inf, typeof$(_nan)   !   NaN   0   Name:*Literal*, Dtype:Real, *NaN*

delay
---- output
 25+0i  5 Name:Z, Dtype:Real, *Complex*
 0+2i  3-4i 
 NaN  0 Name:*Literal*, Dtype:Real, *NaN*

==== x1142_variable_names_and_data_type_53744 | variable_names_and_data_types-advanced | tutorial.txt line 53744 | expected: DIFFERENT
// Sheerpower Exact REAL vs. Standard Double Simulation
// Purpose: Process 10 million Micro-Fees against a Global Balance

// Standard double precision would lose precision here:
// 1. $105 Trillion requires 15 digits of precision.
// 2. The micro_fee is at the 5th decimal place.
// 3. Total precision needed: 20 digits (exceeds Double's ~16 digit limit).
balance    = 105_000_000_000_000  // $105 Trillion (IP=105T, FP=0)
micro_fee  = 0.00001              // For doubles, an "Impossible" binary fraction
iterations = 10_000_000

print "Processing 10 million Transactions..."

start timer

// This loop uses Register-Speed Integer Math
for i = 1 to iterations
    balance = balance + micro_fee
next i

print "--- Results ---"
print sprintf$("Final Balance: %m", balance)  // %m = money format with commas
print "Time Elapsed:  "; _elapsed; " seconds"

// Sheerpower remains exact.
if balance = 105_000_000_000_100   then
    print "Verification: PERFECT. Zero drift after 10 million operations."
else
    print "Verification: FAILED. Precision was lost:"; balance
end if

delay
---- output
Processing 10 million Transactions...
--- Results ---
Final Balance: 105,000,000,000,100
Time Elapsed:   0.469  seconds
Verification: PERFECT. Zero drift after 10 million operations.

==== x1143_variable_names_and_data_type_53843 | variable_names_and_data_types-advanced | tutorial.txt line 53843 | expected: none
  name$ = "A" + chr$(0) + "B"

  delay
---- output


==== x1145_variable_names_and_data_type_53876 | variable_names_and_data_types-advanced | tutorial.txt line 53876 | expected: none
  text$ = "The rain in Spain"  // Allocates a buffer
  text$ = "Hello world"        // Reuses same buffer, updates length
  text$ = "X"                  // Still uses same buffer

  delay
---- output


==== x1146_variable_names_and_data_type_53894 | variable_names_and_data_types-advanced | tutorial.txt line 53894 | expected: none
  for i = 1 to 10_000
    num$ = str$(i)
  next i

  delay
---- output


==== x1147_variable_names_and_data_type_54299 | variable_names_and_data_types-advanced | tutorial.txt line 54299 | expected: none
  a$ = "Microsoft"            // Gets a new SID, no runtime cost
  company_b$ = a$             // Inherits SID, no cost after first run
  company_c$ = company_b$     // Contains what a$ contains and a$'s SID

  delay
---- output


==== x1148_variable_names_and_data_type_54311 | variable_names_and_data_types-advanced | tutorial.txt line 54311 | expected: none
  message$ = 'System ready'     // Points to literal, no allocation
  backup$ = message$            // Shares same literal pointer's SID
  message$ = message$ + ' - OK' // NOW triggers a copy on first iteration only

  delay
---- output


==== x1150_variable_names_and_data_type_54367 | variable_names_and_data_types-advanced | tutorial.txt line 54367 | expected: none
  here$ = "40.7128,-74.0060"
  dist1 = geodistance(here$, "34.0522,-118.2437")
  dist2 = geodistance(here$, "41.8781,-87.6298")
  // The 2nd call recognizes cached 'here$' coordinates and avoids the parsing 
  //   and numeric conversion

  delay
---- output


==== x1151_searching_cluster_data_advan_54705 | searching_cluster_data-advanced | tutorial.txt line 54705 | expected: none
        cluster student: name$, city$
        add cluster student
          student->name$ = "Jason Nordahl"
          student->city$ = "New York City"
        end add

        add cluster student
          student->name$ = "Joan Ark"
          student->city$ = "Helena"
        end add

        add cluster student
          student->name$ = "Frank Abbott"
          student->city$ = "San Diego"
        end add

        print findrow(student->name$, "Joan Ark")

        delay
        end
---- output
 2

==== x1154_Sheerpower_VS_Python_advance_55123 | Sheerpower_VS_Python-advanced | tutorial.txt line 55123 | expected: none
declare real x
x = 10
declare string name 
name = 'Alice'
age = 35
color$ = "blue"

delay
---- output


==== x1156_Sheerpower_VS_Python_advance_55164 | Sheerpower_VS_Python-advanced | tutorial.txt line 55164 | expected: none
a$ = "The rain in Spain"
a$ = "Hello"  // a$ reuses the memory originally allocated for "The rain in Spain"

delay
---- output


==== x1157_Sheerpower_VS_Python_advance_55206 | Sheerpower_VS_Python-advanced | tutorial.txt line 55206 | expected: none
for i = 1 to 100_000
  a$ = str$(i)
next i

delay
---- output


==== x1159_Sheerpower_VS_Python_advance_55233 | Sheerpower_VS_Python-advanced | tutorial.txt line 55233 | expected: none
divisor = 0
when exception in
    result = 10 / divisor
use
    print extext$
end when

delay
---- output
Division by zero

==== x1160_Sheerpower_VS_Rust_advanced_55496 | Sheerpower_VS_Rust-advanced | tutorial.txt line 55496 | expected: none
// ownership and borrowing shape APIs
// fn compute(data: &[u8]) - zero-copy where possible
---- output


==== x1161_Sheerpower_VS_Rust_advanced_55503 | Sheerpower_VS_Rust-advanced | tutorial.txt line 55503 | expected: none
a$ = "The rain in Spain"
a$ = "Hello"  // memory reused in most cases

declare real total, tax, due
total = 12345.67
tax   = 0.12
due   = total * (1 + tax)  // exact decimal result

delay
---- output


==== x1163_Sheerpower_VS_C_and_CPP_adva_55593 | Sheerpower_VS_C_and_CPP-advanced | tutorial.txt line 55593 | expected: none
declare integer x
x = 10
declare string name 
name = 'Alice'
print 'Hello, '; name

delay
---- output
Hello, Alice

==== x1166_Sheerpower_VS_C_and_CPP_adva_55678 | Sheerpower_VS_C_and_CPP-advanced | tutorial.txt line 55678 | expected: none
divisor = 0
when exception in
    result = 10 / divisor
use
    print extext$
end when

delay
---- output
Division by zero

==== x1171_IPC_advanced_55907 | IPC-advanced | tutorial.txt line 55907 | expected: none
        ask system, global 'work_id': value this_work_id$
        print 'ID is: '; this_work_id$

        delay
---- output
ID is:

==== x1172_IPC_advanced_55915 | IPC-advanced | tutorial.txt line 55915 | expected: none
        ask system, global 'synch_counter': increment, value my_counter$
        if my_counter$ = '1' then
          print 'I am the first'
        end if

        delay
---- output
I am the first

==== x1173_spvm_hints_56380 | spvm-hints | tutorial.txt line 56380 | expected: none
start timer
for i = 1 to 100_000
  a$ = "my name is "
  b$ = "Sally Sue "
  c$ = "and I am 25 years old"
  d$ = " the end"
  x$ = a$ + b$ + c$ + d$
next i
print 'Elapsed time: '; _elapsed

delay
---- output
Elapsed time:  0.047

==== x1174_teaching_Sheerpower_56649 | teaching_Sheerpower | tutorial.txt line 56649 | expected: none
for i = 1 to 5
  print "Hello, student "; i
next i

delay
---- output
Hello, student  1 
Hello, student  2 
Hello, student  3 
Hello, student  4 
Hello, student  5

==== x1175_teaching_Sheerpower_56658 | teaching_Sheerpower | tutorial.txt line 56658 | expected: none
routine say_hello with name
  print "Hi, "; name
end routine
say_hello with name "Alex"
---- output
Hi, Alex

==== x1176_teaching_Sheerpower_56674 | teaching_Sheerpower | tutorial.txt line 56674 | expected: none
print "I typed this and it runs NOW!"

delay
---- output
I typed this and it runs NOW!

==== x1177_teaching_Sheerpower_56687 | teaching_Sheerpower | tutorial.txt line 56687 | expected: none
print (0.1 + 0.2) - 0.3  // Outputs 0.0, not a tiny error

delay
---- output
 0

==== x1178_teaching_Sheerpower_56700 | teaching_Sheerpower | tutorial.txt line 56700 | expected: none
cluster pets: name$, age
add cluster pets
  pets->name$ = "Fluffy"
  pets->age = 3
end add

print pets->name$; " is "; pets->age

delay
---- output
Fluffy is  3

==== x1180_teaching_Sheerpower_56736 | teaching_Sheerpower | tutorial.txt line 56736 | expected: none
pay = 50000 * 1.1
print "New pay: "; pay

delay
---- output
New pay:  55000

==== x1181_teaching_Sheerpower_56753 | teaching_Sheerpower | tutorial.txt line 56753 | expected: none
cluster student: name$, age, gpa
  student->name$ = "Maria"
  student->age   = 19
  student->gpa   = 3.85
print "Name: "; student->name$; "  Age: "; student->age; "  GPA: "; student->gpa

delay
---- output
Name: Maria  Age:  19   GPA:  3.85

==== x1182_teaching_Sheerpower_56772 | teaching_Sheerpower | tutorial.txt line 56772 | expected: none
word$ = "cat"
print word$; " >> "; "Katze"  // German!

delay
---- output
cat >> Katze

==== x1185_vibe_programming_57335 | vibe_programming | tutorial.txt line 57335 | expected: none
sep$ = chr$(13) + chr$(10)

inname$ = "@app_log.txt"
data$   = fileinfo$(inname$, "contents")

errors = 0

for idx = 1 // increment forever

  VIEW line$ INTO data$,
       PIECE sep$, MATCH idx

  if line$ = '' then exit for

  // Example: count lines containing "error"
  // contains() defaults to case-insensitive
  if contains(line$, "error") then errors++

next idx

print "Errors found: "; sprintf$("%m", errors)

delay
---- output
Errors found: 0

==== x1187_ai_coding_guide_57682 | ai_coding_guide | tutorial.txt line 57682 | expected: none
<pre>
// UNVERIFIED: exact syntax for sorting a cluster array descending
// confirm against Cluster Sorting tutorial before running
</pre>
---- output
<pre>
</pre>

==== x1190_ai_coding_guide_57863 | ai_coding_guide | tutorial.txt line 57863 | expected: none
routine calculate_tax with income, rate, returning tax
  tax = income * rate
end routine
---- output


==== x1193_ai_coding_guide_57978 | ai_coding_guide | tutorial.txt line 57978 | expected: none
routine log_event with event$, stamp$ = fulltime$
  print stamp$; "  "; event$
end routine

log_event with event$ "backup started"                  // stamp$ is now
log_event with event$ "restored", stamp$ "18-AUG-2026"  // explicit override
---- output
20261016 061959  backup started
18-AUG-2026  restored

==== x1200_ai_coding_guide_58169 | ai_coding_guide | tutorial.txt line 58169 | expected: none
a$ = "I need 5 widgets at $12.99 each"
qty   = val(a$, 1)
price = val(a$, 2)
print qty, price

delay
---- output
 5  12.99

==== x1201_ai_coding_guide_58202 | ai_coding_guide | tutorial.txt line 58202 | expected: none
when exception in
  // protected code here
  x = 10 / y
use
  if extype = exceptiontype("divby0") then
    y = 1
    retry    // re-executes the failing statement
  else
    print "Error: "; extext$
    continue // resumes at the statement AFTER the one that failed
  end if
end when

delay
---- output


==== x1209_ai_coding_guide_58399 | ai_coding_guide | tutorial.txt line 58399 | expected: none
routine validate_amount with amount, returning ok?
  ok? = false
  if amount <= 0 then exit routine   // early exit -- ok? stays false
  if amount > 1_000_000 then exit routine
  ok? = true
end routine
---- output


==== x1211_ai_coding_guide_58442 | ai_coding_guide | tutorial.txt line 58442 | expected: none
declare string shipping_address    // explicit string, no $ suffix needed
declare real   salary              // explicit real
declare boolean is_manager         // explicit boolean, no ? suffix needed
declare dynamic x                  // type determined at first use

delay
---- output


==== x1212_ai_coding_guide_58450 | ai_coding_guide | tutorial.txt line 58450 | expected: none
const max_retries = 5
const app_name$ = "OrderSystem"

delay
---- output


==== x1213_ai_coding_guide_58489 | ai_coding_guide | tutorial.txt line 58489 | expected: none
a$ = "\"       // a$ contains exactly one character: "\"

b$ = "\n"      // contains two characters: "\" and "n"

delay
---- output


==== x1215_ai_coding_guide_58521 | ai_coding_guide | tutorial.txt line 58521 | expected: none
h$ = %text
<h1>Report</h1>
<p>Generated nightly.</p>
%end text

delay
---- output


==== x1221_ai_coding_guide_58737 | ai_coding_guide | tutorial.txt line 58737 | expected: none
routine total_of with values(*), returning total
  total = stats$sum(values)
end routine
---- output


==== x1222_ai_coding_guide_58766 | ai_coding_guide | tutorial.txt line 58766 | expected: none
dim flags?(50)                               // one bit per flag
fill flags? with true
fill flags?(4 step 3) with false             // 4, 7, 10, ... 49
flags?[5:*:10] = false                       // 5, 15, 25, 35, 45
print stats$sum(flags?)                      // how many are still true:  30

delay
---- output
 30

==== x1223_ai_coding_guide_58789 | ai_coding_guide | tutorial.txt line 58789 | expected: none
cluster employee: name$, age, salary, position$
employee->name$     = "Maria Santos"
employee->age       = 34
employee->salary    = 62_000
employee->position$ = "Senior Analyst"
print employee->name$; " earns "; employee->salary

delay
---- output
Maria Santos earns  62000

==== x1224_ai_coding_guide_58799 | ai_coding_guide | tutorial.txt line 58799 | expected: none
cluster orders: customer$, amount, region$

add cluster orders
  orders->customer$ = "Acme Corp"
  orders->amount    = 4500
  orders->region$   = "North"
end add

add cluster orders
  orders->customer$ = "Beta LLC"
  orders->amount    = 1200
  orders->region$   = "South"
end add

add cluster orders
  orders->customer$ = "Acme LLC"
  orders->amount    = 5500
  orders->region$   = "East"
end add

add cluster orders
  orders->customer$ = "Alpha LLC"
  orders->amount    = 2200
  orders->region$   = "West"
end add

delay
---- output


==== x1233_ai_coding_guide_59019 | ai_coding_guide | tutorial.txt line 59019 | expected: none
data$ = "hello"
VIEW v$ INTO data$, MID 2, 3 // character positions 2, 3, and 4
// v$ hasn't calculated positions yet
PRINT v$  // NOW it evaluates to "ell" and caches it
PRINT v$  // Reuses cached positions -- no recalculation!

data$ = "world"
PRINT v$  // Re-evaluates to "orl" because source changed

delay
---- output
ell
ell
orl

==== x1234_ai_coding_guide_59031 | ai_coding_guide | tutorial.txt line 59031 | expected: none
csv_line$ = "Alice,Santos,42,Manila"

VIEW first_name$  INTO csv_line$, PIECE ",", MATCH 1
VIEW last_name$   INTO csv_line$, PIECE ",", MATCH 2
VIEW age$         INTO csv_line$, PIECE ",", MATCH 3

print first_name$; " "; last_name$; " age "; val(age$)

delay
---- output
Alice Santos age  42

==== x1235_ai_coding_guide_59042 | ai_coding_guide | tutorial.txt line 59042 | expected: none
data$ = "red,green,blue,yellow"

for idx = 1
  VIEW token$ INTO data$, PIECE ",", MATCH idx
  _ = len(token$)                   // using the view resolves it and sets _integer
  if _integer = -1 then exit for    // -1: no such piece -- an empty one still counts
  print idx; ": "; token$
next idx

delay
---- output
 1 : red
 2 : green
 3 : blue
 4 : yellow

==== x1236_ai_coding_guide_59062 | ai_coding_guide | tutorial.txt line 59062 | expected: none
sep$  = chr$(13) + chr$(10)
log$  = fileinfo$("@app.log", "contents")

for idx = 1
  VIEW line$ INTO log$, PIECE sep$, MATCH idx
  _ = len(line$)                    // resolve the view: _integer = -1 past the last line
  if _integer = -1 then exit for    // a blank line is an empty piece, not the end
  if contains(line$, "error") then print line$
next idx

delay
---- output


==== x1241_ai_coding_guide_59195 | ai_coding_guide | tutorial.txt line 59195 | expected: none
print sprintf$("% %p", 1, "item")  // 1 item
print sprintf$("% %p", 3, "item")  // 3 items

delay
---- output
1 item
3 items

==== x1243_ai_coding_guide_59245 | ai_coding_guide | tutorial.txt line 59245 | expected: none
csv$ = "red,green,blue"

count = elements(csv$, ",")
first$ = element$(csv$, 1, ",")
second$ = element$(csv$, 2, ",")

delay
---- output


==== x1254_ai_coding_guide_59518 | ai_coding_guide | tutorial.txt line 59518 | expected: none
main$tax_rate = 0.0825          // global: the prefix SAYS so

delay

private routine compute_total with amount, returning total
  total = amount * (1 + main$tax_rate)
end routine
---- output


==== x1255_ai_coding_guide_59540 | ai_coding_guide | tutorial.txt line 59540 | expected: none
declare freezable main$api_url$

main$api_url$ = trim$(fileinfo$('@config_url.txt', 'contents'))
freeze main$api_url$            // any later write raises an exception

delay
---- output


==== x1257_ai_coding_guide_59570 | ai_coding_guide | tutorial.txt line 59570 | expected: none
//******************************************************************
//  c o m p u t e _ t o t a l
//******************************************************************
// Brief description:
//   Applies the sales tax rate to an invoice amount.
//
// Expected on entry:
//   amount = the pre-tax invoice amount
//   main$tax_rate holds the loaded tax rate (e.g. 0.0825 = 8.25%)
//
// Locals used:  none
//
// Results on exit:
//   total = amount with tax applied
//******************************************************************
---- output


==== x1261_ai_coding_guide_59710 | ai_coding_guide | tutorial.txt line 59710 | expected: none
const tax_multiplier = 1.12

delay

routine total_pending_order with pending_amount, returning order_total
  order_total = pending_amount * tax_multiplier
end routine
---- output


==== x1263_ai_coding_guide_59751 | ai_coding_guide | tutorial.txt line 59751 | expected: none
// the vendor's shape -- only import_vendor_feed knows about it
cluster vendor_feed: cust_nm$, amt_due, rgn$

// our shape -- everything else in the program uses this
cluster customers: name$, balance_due, region$

delay

routine import_vendor_feed
  cluster input name '@vendor_feed.csv', headers 1: vendor_feed

  collect cluster vendor_feed
  end collect

  for each vendor_feed
    add cluster customers
      customers->name$       = vendor_feed->cust_nm$
      customers->balance_due = vendor_feed->amt_due
      customers->region$     = vendor_feed->rgn$
    end add
  next vendor_feed
end routine

// downstream code never mentions cust_nm$ or amt_due
collect cluster customers
  sort by customers->name$
end collect

for each customers
  print customers->name$; tab(30); customers->balance_due
next customers
---- output


==== x1265_ai_coding_guide_59819 | ai_coding_guide | tutorial.txt line 59819 | expected: none
// a row exists in paid_orders ONLY once payment has completed
cluster orders:      id$, customer$, amount
cluster paid_orders: id$, customer$, amount, payment_id$, paid_on$

delay

routine record_payment with orders, order_id$, payment_id$
  row = findrow(orders->id$, order_id$)
  if row = 0 then exit routine
  if payment_id$ = "" then exit routine   // the one place this is checked

  add cluster paid_orders
    paid_orders->id$         = orders->id$
    paid_orders->customer$   = orders->customer$
    paid_orders->amount      = orders->amount
    paid_orders->payment_id$ = payment_id$
    paid_orders->paid_on$    = date$
  end add
end routine

// downstream: the state is guaranteed, so no re-checking
routine invoice_order with paid_orders, order_id$
  row = findrow(paid_orders->id$, order_id$)
  if row = 0 then exit routine
  print f$("Invoice for [[paid_orders->customer$]], payment [[paid_orders->payment_id$]]")
end routine
---- output


==== x1273_ai_coding_guide_60046 | ai_coding_guide | tutorial.txt line 60046 | expected: none
// Change 1: add checkout validation          -- compile, test, done
// Change 2: rename routines for clarity      -- compile, test, done
// Change 3: extend the orders cluster        -- compile, test, done
// Change 4: rewrite the retry loop           -- compile, test, done

%TODO the discount routine also needs the boundary treatment (habit 3) -- separate change

delay
---- output
$error |C:\myprograms\x1273_ai_coding_guide_60046.spsrc|6 |1 |%TODO the discount routine also needs the boundary treatment (habit 3) -- separate change

==== x1274_ai_coding_guide_60105 | ai_coding_guide | tutorial.txt line 60105 | expected: none
// find "the current field value" by re-deriving it each call
routine current_value$ with line$, cursor, returning value$
  value$ = ""
  // where does the field end?  scan for the next separator ...
  stop_at = pos(line$[cursor:len(line$)], "|")
  if stop_at = 0 then stop_at = len(line$) + 1     // guard: no separator left
  if cursor > stop_at then exit routine            // guard: cursor moved past it
  if contains(line$[cursor:stop_at], "{") then exit routine  // guard: spans a hole
  // ... and another guard next week
  value$ = line$[cursor:stop_at - 1]
end routine
---- output


==== x1295_ai_coding_guide_60845 | ai_coding_guide | tutorial.txt line 60845 | expected: none
option abort
---- output


==== x1296_ai_coding_guide_60869 | ai_coding_guide | tutorial.txt line 60869 | expected: none
print "What is your name?"
line input name$
print "Hello, "; name$ ; "!"

delay
---- output
What is your name?

Hello, !

==== x1297_ai_coding_guide_60953 | ai_coding_guide | tutorial.txt line 60953 | expected: none
// Expect:  headless  1   (run with /headless)
//          headless  0   (run in a window)
print 'headless '; _headless
if _headless then print 'answers come from the pipe' else print 'answers come from the keyboard'

delay
---- output
headless  1 
answers come from the pipe

==== x1298_ai_coding_guide_60964 | ai_coding_guide | tutorial.txt line 60964 | expected: none
print "Press ENTER to exit"
line input dummy$

delay
---- output
Press ENTER to exit

==== x1300_ai_coding_guide_61023 | ai_coding_guide | tutorial.txt line 61023 | expected: none
program greet

print "What is your name?"
line input person$
print "Hello, "; person$; "!"

delay
---- output
What is your name?

Hello, !

==== x1305_ai_coding_guide_61076 | ai_coding_guide | tutorial.txt line 61076 | expected: none
program add_two_numbers

print "First number?"
line input a$
print "Second number?"
line input b$

total = val(a$) + val(b$)
print "Total: "; total

delay
---- output
First number?

Second number?

Total:  0

==== x1306_ai_coding_guide_61092 | ai_coding_guide | tutorial.txt line 61092 | expected: none
10
25

delay
---- output


==== x1317_ai_coding_guide_61361 | ai_coding_guide | tutorial.txt line 61361 | expected: none
program probe_element_default
// question: what is element$'s default delimiter?
print "["; element$("alpha, beta, gamma", 2); "]"

delay
end
---- output
[beta]

==== x1318_ai_coding_guide_61383 | ai_coding_guide | tutorial.txt line 61383 | expected: none
program test_my_feature
option abort
fails = 0

if val("12" + ".") <> 12 then
  fails++
  print "FAIL: trailing dot, got "; val("12" + ".")
end if

if len(trim$("  x  ")) <> 1 then
  fails++
  print "FAIL: trim$ length"
end if

print "fails = "; fails
if fails > 0 then abort 33
abort 0
end
---- output
fails =  0

==== x1319_ai_coding_guide_61420 | ai_coding_guide | tutorial.txt line 61420 | expected: none
s$ = mid$("Xabc", 2, 3)      // "abc", constructed at RUN time

caught = 0
when exception in
  v = val(s$)                // now the RUNTIME raise is exercised
use
  caught = extype
end when

if caught = 0 then abort 34

delay
---- output


==== x1321_philosophy_61792 | philosophy | tutorial.txt line 61792 | expected: none
for idx = 1 to 1_000_000
  msg$ = 'hi there '

  subvalue$ = '<table border=2 cellspacing=0 cellpadding=5 ' +
  'bgcolor=lightblue width="325px" ' +
  'style="color:black;font-family:Calibri; ' +
  'font-weight:bold;">' + msg$ +
  '</td></tr></table><br>'

next idx

delay
---- output


==== u1322_intro_377 | intro | tutorial.txt line 377 | expected: none
print "Hello world"
print "The result of (0.1+0.2) - 0.3 is: "; (0.1+0.2) - 0.3

delay
---- output
Hello world
The result of (0.1+0.2) - 0.3 is:  0

==== u1323_intro_part_2_1277 | intro_part_2 | tutorial.txt line 1277 | expected: none
a$ = 'Sally'
b$ = 'Sue'
x = 10
y = 20
say_hello

tax_rate = 6.5/100
show_tax with rate tax_rate, client a$

delay

routine say_hello
  print 'Hello '; a$; ' '; b$; '!'
end routine

routine show_tax with rate, client
  print 'Tax for '; client;' is'; round((x+y)*rate, 2)  // (10+20)*6.5/100 and ,2 is for 2 decimal places
end routine
---- output
Hello Sally Sue!
Tax for Sally is 1.95

==== u1324_intro_users_1539 | intro_users | tutorial.txt line 1539 | expected: none
a$ = 'Sally'
b$ = 'Sue'
x = 100
y = 200
// Click on the "Run" button to try this code example. 
// Try your own values for a$, b$, x, and y in the fields above.
// The results are output below this window.

print "Hello World"

print 'a';'b';'c'
print sprintf$('%s is %r %p old.', "Sally",10, "year")

print (0.1 + 0.2) - 0.3

print (10.7 + 3.2)

full_name$ = 'Tom Smith'
print full_name$; ' and '; a$;' '; b$

income = 50

print income + x + y

delay
---- output
Hello World
abc
Sally is 10 years old.
 0 
 13.9 
Tom Smith and Sally Sue
 350

==== u1325_program_structure_2471 | program_structure | tutorial.txt line 2471 | expected: none
print 'Hello world'
print '0.1+0.2 - 0.3 = '; 0.1+0.2 - 0.3

delay
---- output
Hello world
0.1+0.2 - 0.3 =  0

==== u1326_variable_names_and_data_type_3476 | variable_names_and_data_types | tutorial.txt line 3476 | expected: none
! Try the "Putting It All Together" example yourself!
! You can change the values to see different results.

! Define a constant for the sales tax rate
const sales_tax_rate = 0.08

! Declare variables to hold item information
declare string item_name$
declare real item_price
declare integer quantity

! Assign values to our variables
item_name$ = "Super Gadget"
item_price = 29.95
quantity = 2

! Calculate the subtotal
subtotal = item_price * quantity

! Calculate the final total including tax
final_total = subtotal * (1 + sales_tax_rate)

! Print a summary using a formatted string
print sprintf$("Item: %s, Qty: %i, Total: $%.2m", item_name$, quantity, final_total)

const last_term = 5000
previous = 0
current  = 1

print "The Fibonacci series, F(1) through F("; str$(last_term); "):"
print
start timer

for term = 1 to last_term
  if mod(term, 10) = 0 then print sprintf$("F(%) = %m", term, current)  // show every 10th term
  next_value = previous + current
  previous   = current
  current    = next_value
next term
print 'Elapsed secs:';_elapsed

! whole arrays and clusters freeze too
dim rates(3)
fill rates with 0.1, 0.2, 0.3
declare freezable rates
freeze rates
when exception in
  rates(2) = 9
use
  print 'rates: '; extext$
end when
print 'rates(2) is still '; rates(2)
cluster cities: city$, population
add cluster cities
  cities->city$ = 'Cebu'
  cities->population = 1_000_000
end add
declare freezable cities
freeze cities
when exception in
  add cluster cities
    cities->city$ = 'Davao'
  end add
use
  print 'cities: '; extext$
end when
print 'cities still has '; size(cities); ' row'

delay
---- output
Item: Super Gadget, Qty: 2, Total: $64.69
The Fibonacci series, F(1) through F(5000):

F(10) = 55
F(20) = 6,765
F(30) = 832,040
F(40) = 102,334,155
F(50) = 12,586,269,025
F(60) = 1,548,008,755,920
F(70) = 190,392,490,709,135
F(80) = 23,416,728,348,467,685
F(90) = 2,880,067,194,370,816,120
F(100) = 354,224,848,179,261,915,075
F(110) = 43,566,776,258,854,844,738,105
F(120) = 5,358,359,254,990,966,640,871,840
F(130) = 659,034,621,587,630,041,982,498,215
F(140) = 81,055,900,096,023,504,197,206,408,605
F(150) = 9,969,216,677,189,303,386,214,405,760,200
F(160) = 1,226,132,595,394,188,293,000,174,702,095,995
F(170) = 150,804,340,016,807,970,735,635,273,952,047,185
F(180) = 18,547,707,689,471,986,212,190,138,521,399,707,760
F(190) = 2,281,217,241,465,037,496,128,651,402,858,212,007,295
F(200) = 280,571,172,992,510,140,037,611,932,413,038,677,189,525
F(210) = 34,507,973,060,837,282,187,130,139,035,400,899,082,304,280
F(220) = 4,244,200,115,309,993,198,876,969,489,421,897,548,446,236,915
F(230) = 522,002,106,210,068,326,179,680,117,059,857,997,559,804,836,265
F(240) = 64,202,014,863,723,094,126,901,777,428,873,111,802,307,548,623,680
F(250) = 7,896,325,826,131,730,509,282,738,943,634,332,893,686,268,675,876,375
F(260) = 971,183,874,599,339,129,547,649,988,289,594,072,811,608,739,584,170,445
F(270) = 119,447,720,249,892,581,203,851,665,820,676,436,622,934,188,700,177,088,360
F(280) = 14,691,098,406,862,188,148,944,207,245,954,912,110,548,093,601,382,197,697,835
F(290) = 1,806,885,656,323,799,249,738,933,639,586,633,513,160,792,578,781,310,139,745,345
F(300) = 222,232,244,629,420,445,529,739,893,461,909,967,206,666,939,096,499,764,990,979,600
F(310) = 2.733275920376239100090826796217533933290687271629068978375074545e+64
F(320) = 3.361707149818144672666187219454104827980338677164658343636350709e+66
F(330) = 4.134626466684280323469401197248927185022487504185366855774873864e+68
F(340) = 5.085254383306682983400096853894235027094861596280284766768731218e+70
F(350) = 6.254449428820551641549772190170184190608177514674331726439961911e+72
F(360) = 7.692464272010947850807879784223937130945348856889799995044476277e+74
F(370) = 9.461105609630583801329537157376425652643718276222986560732061825e+76
F(380) = 1.16363906534184169808502499155945811590386789448685844897009316e+79
F(390) = 1.431181439314368982806567444246559718305231073036073662367607266e+81
F(400) = 1.760236806450139664682269453924112507703843833044921918867259928e+83
F(410) = 2.164948153789740350660910771582233728503897391537950352840492951e+85
F(420) = 2.662710205480735617346452022100755074809023407208374441801919604e+87
F(430) = 3.274917057925925835301069896106770518642248401127146768381077062e+89
F(440) = 4.027881710228340703858581327009117662422484631045669687664544594e+91
F(450) = 4.953967011875066473162524925231604047727791871346061001150551742e+93
F(460) = 6.092976636435308927919519799902172066938941753292550464446412187e+95
F(470) = 7.493865866114242474693693101387148481930125577362702465168971932e+97
F(480) = 9.216845717656874712980450562726202415567360565980794777111390837e+99
F(490) = 1.133597084613134447271848482284309025629966048359864130560049383e+102
F(500) = 1.394232245616978801397243828704072839500702565876973072641089627e+104
F(510) = 1.714792302400422612273882724457781161683301159423840892935484236e+106
F(520) = 2.109055108727958115216736026700200421586510355834736601003381501e+108
F(530) = 2.593966304505148439455357924568800740435239407560783635144865698e+110
F(540) = 3.19036764903045978471856857361695489069318582026418039756808447e+112
F(550) = 3.923892811677015020359893809756397635478575034984185810645229412e+114
F(560) = 4.826069121597825429064197529143007396149577974448522129053875369e+116
F(570) = 5.935672630284157576246926971464923457500433051068183800155202181e+118
F(580) = 7.300394728337354036240813755148941551985917695016421221977993294e+120
F(590) = 8.978891948591917048818576226136051616596928721565091284652916228e+122
F(600) = 1.104330705729522423464322467677182859425902373575556063800088916e+125
F(610) = 1.358236979127826661690628449480673556577693950210718307561262838e+127
F(620) = 1.670521051256653841637126560614460756304620968521825962693973282e+129
F(630) = 2.05460506934777144254749660671083866289902602188682486228283101e+131
F(640) = 2.526997183192633208949257113598270109290171544823942398011612744e+133
F(650) = 3.108001074820004069863331500065201150560621097531260467068055392e+135
F(660) = 3.822588622310285742611002819368837588178634932808967980253906972e+137
F(670) = 4.701473205334169463004547134673663713344664905245277489665598769e+139
F(680) = 5.782429783698797410921331875366669483655119969958410415490661095e+141
F(690) = 7.111918486628987398486937751987536098524463096558320283304546585e+143
F(700) = 8.747081495575284620397841301757132734236724096769738107423043228e+145
F(710) = 1.075819904770893718434949610738607450950131819271712204010201272e+148
F(720) = 1.323171012053243520828784042795469593341319770463238313551473334e+150
F(730) = 1.62739276283501244124756087767735373906472830448785595444791118e+152
F(740) = 2.001560781185859978382417001138865552090281682543016500139575604e+154
F(750) = 2.461757021582324272166248155313036893697139996697461509576233202e+156
F(760) = 3.027760980468140268766646989334921492692273167769623355128752881e+158
F(770) = 3.72389983027365429815575917206642213232212628235696698065740842e+160
F(780) = 4.58009401513854797270470711694276573060694609998229242387309948e+162
F(790) = 5.633143248637386640996974177922395206433311490349983984665846621e+164
F(800) = 6.928308186422471713629007768132851827339912438520482071896604032e+166
F(810) = 8.521255754974776469099579857385615508107448968231157950034356376e+168
F(820) = 1.048045174780033280982112032380749378978942823968047223033506868e+171
F(830) = 1.289010352421891187843306804029747879989018598991015772751713104e+173
F(840) = 1.585377928961448157719169157753351817448594982476552595762303768e+175
F(850) = 1.949885951587339044875793733356219760673772926586260591210358464e+177
F(860) = 2.39820118265953088038145437511237497044699584020285287192916468e+179
F(870) = 2.949592466076064248964701302014885591673737506156850406413751521e+181
F(880) = 3.627758913155293073138544456040798040261652432988905714601721453e+183
F(890) = 4.461848503934402873535513210799980100962665118825738343919476011e+185
F(900) = 5.487710883948000005141367394838371444380051930912359272449495318e+187
F(910) = 6.749438202405646566036528344330116878577367608510319331278487295e+189
F(920) = 8.301260217870550476224415726786559923505724153274601541545294421e+191
F(930) = 1.020987512416053652109942769111303569422418297176690886416758429e+194
F(940) = 1.255731627669567286590467361849635524790339448285797044277197414e+196
F(950) = 1.544447803282326157141063860798140565135175279561812695372311143e+198
F(960) = 1.899545224874494216554849502045527931563786559916201035603514986e+200
F(970) = 2.336286181815299653746750781129919541766943951168971092522786201e+202
F(980) = 2.873442049110331124686847975839596483580184681281842823699466677e+204
F(990) = 3.534100091787525753399448335204590682849450463581549776041091733e+206
F(1000) = 4.346655768693745643568852767504062580256466051737178040248172885e+208
F(1010) = 5.34603318548412838901434895919647651464716829859037083452764854e+210
F(1020) = 6.575186152568608543923292334534915706757991360660982408664982888e+212
F(1030) = 8.086944364340840096186748136582026671660864656783149325574476189e+214
F(1040) = 9.946284049523976457455307878762439314572187728707207572215739216e+216
F(1050) = 1.223312068647805695866041001606414215425662481984418699889280179e+219
F(1060) = 1.504574381596305766150655878897101860580419130963547928788092463e+221
F(1070) = 1.850504158156591311795720126943274647092372964836965510539364801e+223
F(1080) = 2.275969657094447682932120690552338105737560704836371223170539896e+225
F(1090) = 2.799257627810354990875328877366681542592490429652252907948710136e+227
F(1100) = 3.442859285241027194008361307091963063578189472401787439654596413e+229
F(1110) = 4.234436995083682413131196874835377900046913802011233325484358717e+231
F(1120) = 5.208013218024405265431971319916805620751346157526576811601795762e+233
F(1130) = 6.405432814470510108240011603810187375734151082377488354937660354e+235
F(1140) = 7.878161560476924992608671075554538791590930696708558018892162058e+237
F(1150) = 9.689498176105170689897841421771701694919271341843288614401865563e+239
F(1160) = 1.191729494045331225607508408167163763087154465739757413991240542e+242
F(1170) = 1.465730382693996355790336363631393711580250800146483186323081848e+244
F(1180) = 1.80272919776421098449955297642579754886739976873360034343599155e+246
F(1190) = 2.217210340211710111298871127367367845735743690462313774107637298e+248
F(1200) = 2.726988445540627015799161531364219870500077999291772582118050277e+250
F(1210) = 3.353974066980950058421838796465253703930522364759834044627791077e+252
F(1220) = 4.12511540354201450915728180349912563384749250085466669763397122e+254
F(1230) = 5.073556548949979751257614434424278004262022723814764054685321818e+256
F(1240) = 6.240062043668120892595950026161512032678903201042074320593182441e+258
F(1250) = 7.67476895805689369991789277073521737239462473500936993792414587e+260
F(1260) = 9.439341812205612438809748513001701216842120533741420816214640101e+262
F(1270) = 1.160962295211709761036599888171501897497856879402844666695021491e+265
F(1280) = 1.427889229692280949950629764965817316910195540460161525826714287e+267
F(1290) = 1.756187656291984397463170950919138149609790729078058392300189072e+269
F(1300) = 2.159968028316171580784705206654043342288351577211965806376649888e+271
F(1310) = 2.656585056063261845925441087089381397199711460897810136004049343e+273
F(1320) = 3.267383622154980453330214066599273714221416261746585270704343029e+275
F(1330) = 4.018616196745019631411570757808397730352622030802210101952741521e+277
F(1340) = 4.942571183634158648590899010697669280962302956260543766874801636e+279
F(1350) = 6.078960694250340635803664626082352375810597373997388612245810736e+281
F(1360) = 7.476627396809555566173648400180223655318938539721161938685659724e+283
F(1370) = 9.195643802006328312330007165759066860804713344119629445722136881e+285
F(1380) = 1.130989421372810286860929144904363421642426551941317210204435979e+288
F(1390) = 1.391025031850536589555819548160709417951576611754378972256999033e+290
F(1400) = 1.710847690234022724124971951323182147738274989802692004155088367e+292
F(1410) = 2.104203556484662897014759918172697970776283079796135727213532993e+294
F(1420) = 2.587999289707111961055742202157286185840054360650266675272230072e+296
F(1430) = 3.183028705984099245808861432661644738786189235291848397012121636e+298
F(1440) = 3.91486650843147136114879398795360730008842875397290850165738239e+300
F(1450) = 4.814967502500111364288435719039670814634888748463148272198879129e+302
F(1460) = 5.92201854142429383093866105501999974127090431773427508395445559e+304
F(1470) = 7.283601309201631400918124254102695714681748821938312038436760484e+306
F(1480) = 8.958237408463864193746198966440813729084423960552350379768819946e+308
F(1490) = 1.101790365227963279516773291629679061720237329659719713591180486e+311
F(1500) = 1.35511256685631019516369368671484083777860107124184972421335431e+313
F(1510) = 1.666678278196738743723391557330091262561507293894509188811066684e+315
F(1520) = 2.049878770925303023760255246147340768866876111383122117265190685e+317
F(1530) = 2.521184220410303045350741613605496136580001466271850753317303436e+319
F(1540) = 3.100851603227580215479036159210145513916515115903238114368556707e+321
F(1550) = 3.813795353547882634734679401667118432503655592414355695597993018e+323
F(1560) = 4.690658199703572882702107760434634657428104727158067181774094556e+325
F(1570) = 5.769128206100039857460119077394433916793318448845181198012576506e+327
F(1580) = 7.095558627683078667387676254419110254190038881606857066837291694e+329
F(1590) = 8.726960199229576756901095781027766169262068492531549674090067525e+331
F(1600) = 1.073345148918961110312160904303871047716692524192564541342409932e+334
F(1610) = 1.320127263568329869916388901335951111029839184071929070354423316e+336
F(1620) = 1.623649199674153843886127132552789479461930527156053500081806438e+338
F(1630) = 1.996956502872852394992944734149797464627071564483538612193586476e+340
F(1640) = 2.456094133613641030456933410290995602543351831262036887648103184e+342
F(1650) = 3.020796088694491182222528800184509611381860045295857017945947557e+344
F(1660) = 3.715333579680862790030664730885917722439433520530777928384750686e+346
F(1670) = 4.569558223398591782619495366109660347639365044248327266211448752e+348
F(1680) = 5.62018508142229980634297623384179363582417506107338945964724349e+350
F(1690) = 6.912370694327088902623598818088795206028971388615844202639488344e+352
F(1700) = 8.501653935514177120246392248625833924052052390491381030300605937e+354
F(1710) = 1.045634310361300514901280010592796684706342154316553708284948135e+357
F(1720) = 1.2860451852050444915573719491066536638495603292854561473801832e+359
F(1730) = 1.581731014371168594564077369400124726866488570805679405906796841e+361
F(1740) = 1.945400543158016866864659427167242748679395986058057123650622096e+363
F(1750) = 2.392684494982923629384074687678768568402970413994329694149674499e+365
F(1760) = 2.942807388774680262455725399902168614860785669614419718091734572e+367
F(1770) = 3.619413819743358430457603834410899519421926076584336820283418556e+369
F(1780) = 4.451584717545453401436607143785416192027482995631772846976795652e+371
F(1790) = 5.475087261198933347923981026472620826241861892019422168099430309e+373
F(1800) = 6.7339121728029334726063530018469450746582873788843260894776016e+375
F(1810) = 8.282164463821488277971021794169095179747069289838519147840640022e+377
F(1820) = 1.018638889928315028855709617152780237658142939776349011923503947e+380
F(1830) = 1.252843012967189270609743118879978001367718345232010899474431449e+382
F(1840) = 1.540895042060649971347098465260657663658527750341395771452358332e+384
F(1850) = 1.895175617433302745829870137958720928499852361085393597796453305e+386
F(1860) = 2.330911919938756312373605559842700676288452551359999985712492329e+388
F(1870) = 2.866832143962926933944951851592725959741946652936691443066585919e+390
F(1880) = 3.525970445882406253121053416903068660414965537856994474973329432e+392
F(1890) = 4.336656965220963398645501207605615179714433416898809535072888543e+394
F(1900) = 5.333735470177196739708654380013216364182711606231750028692155574e+396
F(1910) = 6.560060962621429893501780337295495566426763832323362654337844064e+398
F(1920) = 8.068341610477341049333218949435458225068501242597112889832678985e+400
F(1930) = 9.923404174790867347690509129771884067277613852011216518228761367e+402
F(1940) = 1.220498030083171910355439290772447385692895818784953660613239321e+405
F(1950) = 1.501113342960553541063713422558812565561589080966972890389102078e+407
F(1960) = 1.846247362038472538317331965818262210902185280007498159812534232e+409
F(1970) = 2.270734143973025166776211946614206638153131735501126039280378195e+411
F(1980) = 2.792818372350617107880908961138892338707261816138384278498883925e+413
F(1990) = 3.43493952457686174017684040100617615594611672067666254994969919e+415
F(2000) = 4.224696333392304878706725602341482782579852840250681098010280114e+417
F(2010) = 5.19603299612007731463525480683992320495762438183627008429764957e+419
F(2020) = 6.390698115594355866513492739852871393819620004374587135576307944e+421
F(2030) = 7.860039078881445708080132544538347822077636842942558549750429006e+423
F(2040) = 9.667208997212618785351911680508182534016111354818909557479470047e+425
F(2050) = 1.188988106266363296141204335377061068205760920274296449984477312e+428
F(2060) = 1.462358698617654728065827813396980032067745770823836444385332299e+430
F(2070) = 1.79858230048908867919135409004474773333650672202129139694896028e+432
F(2080) = 2.21210999373171730993255894797370001400069649350910603460278261e+434
F(2090) = 2.720715434059963382349128370598646542447523036343998293421727715e+436
F(2100) = 3.346258772894381788558434639941537877209053265053766990305264812e+438
F(2110) = 4.115626219116683603588639694291031724312890763712498998246133547e+440
F(2120) = 5.061885623636231394235170980513974867117134734039868391143713735e+442
F(2130) = 6.22570775445065294654890144206275998338164443379266687120694328e+444
F(2140) = 7.657114349411939501115725256639143382072710940091576264745425861e+446
F(2150) = 9.417628079001240521077687175521940083951096291869259538949753114e+448
F(2160) = 1.158291682573658464697544365336632238892164116790518007528172179e+451
F(2170) = 1.424604593284809899172768792492302434436522352689418456664262283e+453
F(2180) = 1.75214782057205881013603586032899833113303327739630564989628979e+455
F(2190) = 2.154999358844303855477406831325418717050187278962187007526770016e+457
F(2200) = 2.650473996596436536356196798944232122138617049795750388692937491e+459
F(2210) = 3.259867515877732509332574322018272968358793952520876759391560437e+461
F(2220) = 4.009371997129951342825430796402581327869102699895698839012750044e+463
F(2230) = 4.931201569718252378424346622142973205982160441476457484309743399e+465
F(2240) = 6.064976993553737430327663802156216785225270432746053135817083105e+467
F(2250) = 7.459428581914125214065184041989932348506484416233497711306581246e+469
F(2260) = 9.174490658055018639557143605267401166984453304923927579593513226e+471
F(2270) = 1.128387756654948151413388011607470444215602691661480757312889061e+474
F(2280) = 1.387825195779005676052071682841135972373521466210572092219057609e+476
F(2290) = 1.70691215203251148672890683109343649897500984316983752535370957e+478
F(2300) = 2.099363164480411228108950195076642780142024754952279098975840866e+480
F(2310) = 2.582046001095702559425335849261161275924792947606986307987748894e+482
F(2320) = 3.175706645031266106970352199571720705109481123081097930915033556e+484
F(2330) = 3.905860968788347741317590671888290351157069302094989756394692499e+486
F(2340) = 4.803891420945164595209939491202639959852684293464529290572380274e+488
F(2350) = 5.908395861665673617334093815112058321583685974031161528428388268e+490
F(2360) = 7.266846520706684032861414398638711471551948479628982227037860332e+492
F(2370) = 8.937630380883054793057806300944103904176738261346245023103725365e+494
F(2380) = 1.099255868383408672705781560872138393099023286660791848019487842e+497
F(2390) = 1.351995341807783836880180741809720782472756875210160510613739008e+499
F(2400) = 1.662844344836735778495351734269869348602181054179831348870097031e+501
F(2410) = 2.045163344615004229165594615077758326702435420953671543059157974e+503
F(2420) = 2.515384629441971528295831841372215754909135349667598014827877299e+505
F(2430) = 3.093718577879163479380956605426317602705566236549050191083983161e+507
F(2440) = 3.805022312328426882485747041490233429752355557420364975231816499e+509
F(2450) = 4.679868072306177149109530765372444486835126779003394014516025892e+511
F(2460) = 5.755857226705365050716474266703957695464230702618432601357188666e+513
F(2470) = 7.079236402040368394666352394969330720972320251542771760267890454e+515
F(2480) = 8.706885188786982588934541798385606391026407486327347421869369536e+517
F(2490) = 1.070876085856778454755001977677479892789038397615748305172329774e+520
F(2500) = 1.317090516751949629522763087125316412066606964992507141887746928e+522
F(2510) = 1.619914247996312366467523096966371438852647663101022209691411488e+524
F(2520) = 1.992362815983789015792101132959924338147549964917758067206247356e+526
F(2530) = 2.450444272235260858187637641231010298777601192082532320442715106e+528
F(2540) = 3.013847218567772476669215088600846675062634711265022978337818955e+530
F(2550) = 3.706787034411136620217315795214918309297162934736770010123473044e+532
F(2560) = 4.559046667603841265619631506605489435768004146255100610154038062e+534
F(2570) = 5.607256722449283643050125021545230514163715383600300073488454471e+536
F(2580) = 6.896469863945858496825091813349972983477793121413743580329783598e+538
F(2590) = 8.482097206981161022730557917918312246626269167800544573798284981e+540
F(2600) = 1.043228991760043347210890372985818906605196329708252845141385754e+543
F(2610) = 1.283086838892783505459167853193378072001925222849472994078166494e+545
F(2620) = 1.578092488938947707380055370390556446671707504471880957431630649e+547
F(2630) = 1.940925452711016401726922188795065091599000037978128630341497882e+549
F(2640) = 2.387180497585656279353376286680891007022102875962651027224299232e+551
F(2650) = 2.936037919485086121964480140398616432128026637430262950622853906e+553
F(2660) = 3.611087922916897364388375235061630122416770553751627164163387872e+555
F(2670) = 4.4413445413958352495855050911117651889294149784507583856259048e+557
F(2680) = 5.462492677124585667253732424543965019370938746439057651603446565e+559
F(2690) = 6.718421858409100787197132331679965797307361716622195835633676683e+561
F(2700) = 8.263112636575481509685747394723903534186117817570656972064261978e+563
F(2710) = 1.016295670080200134683474958227723335046919417944024585605547886e+566
F(2720) = 1.249961043072280410845577341146152463072369022892974533725103257e+568
F(2730) = 1.537350453411896885326591782113944757245509206216564274023316452e+570
F(2740) = 1.890816061592325940910623334266037436165669086744084759595306726e+572
F(2750) = 2.325550020713219717631534041969014652008048425774602597874824942e+574
F(2760) = 2.860237443871101020092695809288461418226282996794086786910075148e+576
F(2770) = 3.51785950095938293274225269202061064295312728121414928763960495e+578
F(2780) = 4.326681162435653897170961541604422244690523927593724215118023081e+580
F(2790) = 5.321466043845758355227008470904237299905049118212159369666404429e+582
F(2800) = 6.544970565814039211539503323058051436658741363008196652268165646e+584
F(2810) = 8.049781649346883654358066386514312843360261371588260666352877105e+586
F(2820) = 9.900576931640085490939267705080298992189455612917259799948812023e+588
F(2830) = 1.21769046477523704654898634706101163291086943777510707278704035e+591
F(2840) = 1.497660265904225166400343814207993505490447513907252526930060143e+593
F(2850) = 1.842000358015719430967767992841125910589959355162143097416695271e+595
F(2860) = 2.265510674332744477573714596813164070675100962098045284569842178e+597
F(2870) = 2.78639392939347413547257217728090769433931518744507948571116421e+599
F(2880) = 3.427037982086539912183506406595835147630290170461237962896274994e+601
F(2890) = 4.214978078573504744572165622895149140815822978148578186413847128e+603
F(2900) = 5.18408033284720218183254536552037385968869923410570504549274234e+605
F(2910) = 6.375997311594201333179573583027770332503018475652202348137431695e+607
F(2920) = 7.841958285227582919592692252587605471592743855128798317704491716e+609
F(2930) = 9.64497109109876757096569351332445195302582463996085671054171107e+611
F(2940) = 1.186253024622296135399584375216381714167460503276634087413453417e+614
F(2950) = 1.458994770574513258865779124581016263906446160783860318951442286e+616
F(2960) = 1.794444942504189078791368364797128366433512031713820528901532666e+618
F(2970) = 2.207021379803095115587496510788009789086829154391920864516990035e+620
F(2980) = 2.71445685266355657326474157143277232774015650869889128130300759e+622
F(2990) = 3.338561226638194275604073383211231162141483822784197083916247636e+624
F(3000) = 4.106158863079712603335683787192671052201251086373692524088854291e+626
F(3010) = 5.050241545465382682675330650908664271091324687857363384920899155e+628
F(3020) = 6.211386485036112728430323132238937786337109240955919594200297076e+630
F(3030) = 7.639500352439872117701029919588802610767535233906995364527873314e+632
F(3040) = 9.395964294852539093499423768781003317465434626781508706409864143e+634
F(3050) = 1.15562721326333790977925211326086752002214078374178650093476801e+637
F(3060) = 1.421327512670957103637545105073179239594058509656129581062700554e+639
F(3070) = 1.748117277863950903683202554028684377948689752798665206057028204e+641
F(3080) = 2.150042119021392515819975386944774466952928990091392590492038421e+643
F(3090) = 2.644376994668526399368201405686669725914307788837133019784601555e+645
F(3100) = 3.25236869923038533197130573145590928542790328737066447507601071e+647
F(3110) = 4.000149062353907105684769229550199754103729612687033591041514713e+649
F(3120) = 4.919858109825382701459069021773600106619044633276314250533555495e+651
F(3130) = 6.051025460178985332084086419858573111166014525968597824797169109e+653
F(3140) = 7.442269330209169420193280389523867566723535962478047693075464653e+655
F(3150) = 9.153386173611260488304526470472371249758832632395401802700341808e+657
F(3160) = 1.125792076660882948367254823064206425044669178425009641255211288e+660
F(3170) = 1.384632720431149913886840387104269179092445501136437904725882881e+662
F(3180) = 1.702985666922648305785976950655944669641203499479976121848710422e+664
F(3190) = 2.094533907042814301125362965268101516740771059810256986083441231e+666
F(3200) = 2.576106407095969325553617849584699271124184283216668095270447843e+668
F(3210) = 3.168401427337337989000837418692653293331072591250520731484042505e+670
F(3220) = 3.896876144984216129538474663207005080870106868809818832915845237e+672
F(3230) = 4.792840818187852105533423752002746984140898341376952112413341236e+674
F(3240) = 5.894804518756559668193157367497058089985217949206770116385118136e+676
F(3250) = 7.250130273988749606667030219646181175983403987690189547942453971e+678
F(3260) = 8.917070756554286360233627854428053140650588383064012466957579874e+680
F(3270) = 1.0967272017534373348126695557924540744882625370769966315403029e+683
F(3280) = 1.348885287449162378955981217346174231089156414720875216669902991e+685
F(3290) = 1.659019230842294382382375630380215058832213563852968816840826649e+687
F(3300) = 2.040458765407277174092426427245929904940513767897679557192549788e+689
F(3310) = 2.509598379527866694695446267949455761570948713157760558465152157e+691
F(3320) = 3.086601960942735306757989666935105993741772865807255718956417896e+693
F(3330) = 3.796269452121611640642857745703385426726223530071608758260547496e+695
F(3340) = 4.669102765913488044460039228248470564273880764701498047088577779e+697
F(3350) = 5.742616775128378133521783964971048455514200718229835437043124613e+699
F(3360) = 7.062951723131313755427348272991564753226039495346227437758334417e+701
F(3370) = 8.686856357774003081362286197383127541622477159204036764899047017e+703
F(3380) = 1.0684127024889710658700069287953947719720324301871430598082052e+706
F(3390) = 1.314060755497856670989294899556361738250183664358593923196443405e+708
F(3400) = 1.616187887992114808210245725761445398570528703918051811225644568e+710
F(3410) = 1.987779696154751428431503313196622204067925287452767868415223174e+712
F(3420) = 2.444807407481545045489928050659269166463691050696512672969601941e+714
F(3430) = 3.006914333232684930809768351979581412529933199827965310965768864e+716
F(3440) = 3.698260149135454310391466080129819210495171466683327681220598743e+718
F(3450) = 4.548559292003285533288422301724479670767807910700510251370239879e+720
F(3460) = 5.594358103149127660513720284513097013123354213014959276417272992e+722
F(3470) = 6.880605610944226693878547107720936878174648901217329858968108758e+724
F(3480) = 8.462585465651083920704561570468301050453505813076014230603132046e+726
F(3490) = 1.040829206218973879979722287696523819836999468519337577065595561e+729
F(3500) = 1.280135297794681361535851368251019615389004811220654459648376509e+731
F(3510) = 1.574462333366836177301099210719984474546492217854553051609796546e+733
F(3520) = 1.936460656511429029944198444048755801730646527479978188034084914e+735
F(3530) = 2.381689161275721023213633976258897637681240579578587715976763464e+737
F(3540) = 2.929284022303485715649775370954039218767752848228914892832615654e+739
F(3550) = 3.602781178517159858146902342875842349320567879263607459412519579e+741
F(3560) = 4.431127921173876276949124904200190685742421716209414283588115822e+743
F(3570) = 5.449927064926016104661608941931946959228246654149653208067441209e+745
F(3580) = 6.702967177066882421106084086085874740782169142432452504494593876e+747
F(3590) = 8.244104635085772776350017264991432736466145220526501615207543723e+749
F(3600) = 1.013957840443779382666841062753085367837928040433335374145482932e+752
F(3610) = 1.247085702699497782952451007013645088113286828280797245182791931e+754
F(3620) = 1.533814018536337895093248054520508149842559005981337278037419527e+756
F(3630) = 1.886466534229425661186399861959523659797536248674216772261507739e+758
F(3640) = 2.320200455700339929469762505404762050735985329968688496153850777e+760
F(3650) = 2.853657913857995170681689241661661370039282202236619428592010306e+762
F(3660) = 3.509767213999764025945530790993303008943243510218045028318557292e+764
F(3670) = 4.31672830742832395239593470399759653486318558934797172288896627e+766
F(3680) = 5.309224841415438485044405132837944407580823950546983414650596653e+768
F(3690) = 6.529914882110246504209378719920271861670927140613854802847944984e+770
F(3700) = 8.03126438251146165632903138498865059541448230055998670916150727e+772
F(3710) = 9.877802199000886812634287665664048205173646136974722266788369148e+774
F(3720) = 1.214889357833283963337454092562828042730404330024885238947877791e+777
F(3730) = 1.4942151321129492660369421909756218520763455894692390966832218e+779
F(3740) = 1.837763123563144268829105149490758595249632034614161600396468026e+781
F(3750) = 2.26029922046945615573319563965453550997183976801647184457798735e+783
F(3760) = 2.779984264865074757124947726260129601405837951456798952670884794e+785
F(3770) = 3.419154615861995005648112383735993956178183496315061064600730499e+787
F(3780) = 4.205282179083767349471465737222646553139025116672379429563631425e+789
F(3790) = 5.172155164811447640349338045545481660965383075157395192256806578e+791
F(3800) = 6.361330324500172220894738649447220178332107279931928848532915728e+793
F(3810) = 7.823919083618730686936493605015526271182395416008756744176260668e+795
F(3820) = 9.622784339818588727709797660304152591536513150962777602451947332e+797
F(3830) = 1.183524234606850226201435747281360613496279293614261557534147759e+800
F(3840) = 1.455638580723027592340488871179470513074508166014032087990977224e+802
F(3850) = 1.79031710186586325355618116797602059502029541626789804207314857e+804
F(3860) = 2.201944471436939499114868787723387384823655911192913188541173644e+806
F(3870) = 2.708212668157248997585932990782968881273594741225656432101436266e+808
F(3880) = 3.330881387386272573080786091784279385228039166116438120165912489e+810
F(3890) = 4.096713285218299539989608299595585346942360814849096322160862218e+812
F(3900) = 5.038624252679769806929910129893391548800580998347776832445843936e+814
F(3910) = 6.197098159467595032569790498938912046490020391886280594276171953e+816
F(3920) = 7.62192687371987391308014932268187247802784502392029035327644692e+818
F(3930) = 9.374350344859498153585326687848809256769600377382768506470602094e+820
F(3940) = 1.152968873148981074151864381112176719857880567967841323392351293e+823
F(3950) = 1.418057970469798126225257335501098877332625402596671000087527384e+825
F(3960) = 1.744096006790536797149651336228240401447143457137108545975319447e+827
F(3970) = 2.145096282555313280681448617827185583892253189738383844449634168e+829
F(3980) = 2.638294017942356281558466834793815444147326709032498417818452496e+831
F(3990) = 3.244887132440842694988846061934610277742822626790999215532251607e+833
F(4000) = 3.990947343500442279208124809496091260079257098282025785262887631e+835
F(4010) = 4.908540743792299919156494631073998788869711948624212615951798561e+837
F(4020) = 6.037106020130178856334567583740068901183737771097953315042185941e+839
F(4030) = 7.425149550685740763299602478537177348577110487255620156240293527e+841
F(4040) = 9.132330236741448120972877591842354131859727525547302996844056821e+843
F(4050) = 1.123202367623691261472030947771824186445260714537445712410256586e+846
F(4060) = 1.38144758887477283712938833698342532578635208160580275323464716e+848
F(4070) = 1.699068214079208220543000451394835968298568534303683641907374981e+850
F(4080) = 2.089715758558538633984177616381949898474660661985370299270747761e+852
F(4090) = 2.570180476205594598978484168104658891527002757388575099738829008e+854
F(4100) = 3.161113014157025502880137109007092241588365925521748835648832605e+856
F(4110) = 3.887911989365520809082670795661912991264537388116012210338090222e+858
F(4120) = 4.781815635618174892621397064953252270031222150790142843832286091e+860
F(4130) = 5.881244440611418565843410122812934100839276791733064096692678085e+862
F(4140) = 7.233452480388483018498132311353413618805307331616589824647610812e+864
F(4150) = 8.896558426433772970896118401952417457720444090209232177906892033e+866
F(4160) = 1.094204351926550190590037582117033813163426570022419391984301244e+869
F(4170) = 1.345782387285392396696037264819932066016437476686673759818911461e+871
F(4180) = 1.655202915925839992917066831970304737818901753667606482638062666e+873
F(4190) = 2.035765008350054652048322599596992834310647513263487306268835187e+875
F(4200) = 2.503825439978974638020145090821104155728314551138722626062403474e+877
F(4210) = 3.07950171467330379929957362944999841226239583314930248132612939e+879
F(4220) = 3.787536726504165775674673549714415936667174043318528179768532909e+881
F(4230) = 4.658362223428656573699918508785786602259397833698474730867162866e+883
F(4240) = 5.729406781144597169073332298451546079185392618044792066148633474e+885
F(4250) = 7.046704504585511652302828735244523098737806980411724393889732455e+887
F(4260) = 8.666873599962064872615572011120918256839584046644616525277756057e+889
F(4270) = 1.065954985750288124215192329080520500360281459667483715365225098e+892
F(4280) = 1.311037963736854772135960409048929006260577799550538523733974093e+894
F(4290) = 1.612470099897756340914809783897274625650474665301195635821251612e+896
F(4300) = 1.983207119077866613848002438152742896649457780540515578207766085e+898
F(4310) = 2.439183509455786159398951517949484035416268022598304041631970159e+900
F(4320) = 2.999997395918709189399325566834050089272344722017859919649502518e+902
F(4330) = 3.689752878629066724345230552054086661401442381279707870764724902e+904
F(4340) = 4.53809604097416020002569364646984318851484689450183889504864668e+906
F(4350) = 5.581489155110354139359168662102701713207121535999133870122758943e+908
F(4360) = 6.864777851181638175391774885021676122925908004589484476361488631e+910
F(4370) = 8.443118608037903920317947191710451361027546133491465992537618736e+912
F(4380) = 1.03843494101015036581735358683153530064515891533940442223736349e+915
F(4390) = 1.277190546256404570916141732330871315279935190406132524692031717e+917
F(4400) = 1.570840528401276607190272595408288564264255768308009064928975276e+919
F(4410) = 1.932006130878944586386943678178961846913506601499810536610170387e+921
F(4420) = 2.376210456928261713595221696900582242847186694267936159124016678e+923
F(4430) = 2.922545661408674013263483992819898262517348283289411494668879496e+925
F(4440) = 3.594493542486976210142725788998784804672053669776549344826809378e+927
F(4450) = 4.420934802692839871074226372069223319920374278996826752987508646e+929
F(4460) = 5.437390357957944343800284165066244805021593157799119251240152954e+931
F(4470) = 6.687548046808002258887242100394274187844567546665016996350089382e+933
F(4480) = 8.225140358538046983996927755068450626568315923082190993585485925e+935
F(4490) = 1.011625388619711699009033241452415484326024412863642842041051268e+938
F(4500) = 1.244216976598660009311270917708920361214744344663049873800557205e+940
F(4510) = 1.530285718677489840282962325457826802745702941494264980490481257e+942
F(4520) = 1.882127012275652637547112533221356075341093143603479621015911889e+944
F(4530) = 2.314863196527184995198920119629722189989269996338130507351522575e+946
F(4540) = 2.847093519027209978830917035891236158079267986181540176080271176e+948
F(4550) = 3.501693542083815555462508062134257502218500696003660603527998393e+950
F(4560) = 4.306798347411190412221001824721547604112947929285884388321829996e+952
F(4570) = 5.297011797961555825476285993601290127308704102952037431575498098e+954
F(4580) = 6.514893831657972546294609671947114701829294751838077452399030475e+956
F(4590) = 8.012789711759510076359822267895590954237301674350540062707649934e+958
F(4600) = 9.855079856081031596667951928544382162241698129975980469385169517e+960
F(4610) = 1.212094694400849291289394488988280050046186496970302092333748774e+963
F(4620) = 1.490777923314483817969988541936299017735186974292171813765817141e+965
F(4630) = 1.833535636207375011173956967132748963809275359729674300722721708e+967
F(4640) = 2.255099754742739815362170070719087595583635173770070172707571119e+969
F(4650) = 2.773589344769949235394351791287764467671490336201213345000240205e+971
F(4660) = 3.411289384091563285553516486276878386476374750010115407333024694e+973
F(4670) = 4.195608583498145846307285842941431638919173793478821829685120349e+975
F(4680) = 5.160257428764310234629406235169333228031936128503949838971964726e+977
F(4690) = 6.3466970765217517740095389406739857273153895206805104197525481e+979
F(4700) = 7.805921378378878251008269956405485511275125916824177421311736962e+981
F(4710) = 9.600648625698368073562771092484679780295673338741670177171461211e+983
F(4720) = 1.180801721747115484265710761676051558121255069406057190017876611e+986
F(4730) = 1.452290111262695061966088609150618569691340778636062927020216517e+988
F(4740) = 1.786198756680940214669862418179093235564537032215416794515864528e+990
F(4750) = 2.196879241706430194537734165499369617887411415547099050961811349e+992
F(4760) = 2.701982847423241045259946037322406720677959587419710291003576372e+994
F(4770) = 3.323219214406415842650279852490010329472101551384688948029302756e+996
F(4780) = 4.087289435435149162355318223958980464578617112244425435046942031e+998
F(4790) = 5.027033683663792828112776387484296970398751837905504816212935767e+1000
F(4800) = 6.182842701962921663662479424783289375544006898912546481398406301e+1002
F(4810) = 7.604393820046027267022038414844697502222088610478641621638418458e+1004
F(4820) = 9.35278611438641724627074100231649959879561459019883793996711486e+1006
F(4830) = 1.150316648131328861018630922900781003676838373708352280199738744e+1009
F(4840) = 1.414795949340390634880453327757937469526523243515371316266278984e+1011
F(4850) = 1.740083986023867348016855730049973009417255905686535883779503177e+1013
F(4860) = 2.14016182321442279899724450262869100783627211167008759991716228e+1015
F(4870) = 2.632225034155137656031809052660284942337672971763639094309731654e+1017
F(4880) = 3.237422775828497874639225410321887609974554128058109077240978219e+1019
F(4890) = 3.981766791765636872040644073790655731774467810214297801096972237e+1021
F(4900) = 4.897249411594150502822528288221474361321597951150780484441551755e+1023
F(4910) = 6.02321859958162855478450573010503439885238803313443856608299896e+1025
F(4920) = 7.408069152544243707334659795200370163152305120960244358233644563e+1027
F(4930) = 9.111322735769461597166153097523444797237450059977787116770774508e+1029
F(4940) = 1.120618615808118334014363484397431706358574834326058212919222928e+1032
F(4950) = 1.378269784216627856221695424277865764373074671720451824019476493e+1034
F(4960) = 1.695159772724871451319283935513335147008245988732723137722664164e+1036
F(4970) = 2.084908693473170222337097071138974444243705258674077414216474974e+1038
F(4980) = 2.564268176994726886329497469107387232905056643570241947172491951e+1040
F(4990) = 3.153841366834166753163048177294972399028795301065530187280743451e+1042
F(5000) = 3.878968454388325633701916308325905312082127714646245106160597197e+1044
Elapsed secs: 0.015 
rates: Cannot assign into this variable
rates(2) is still  0.2 
cities: Cannot assign into this variable
cities still has  1  row

==== u1327_operators_5284 | operators | tutorial.txt line 5284 | expected: none
! --- Putting It All Together: A Simple Discount Calculator ---

! Customer's details
is_club_member? = false
purchase_total = 120.00
number_of_items = 3

print "Customer is a club member: "; is_club_member?
print "Purchase total: $"; purchase_total
print "Number of items: "; number_of_items
print

! --- Rule for Discount ---
! The customer gets a 10% discount if they are a club member
! OR if their purchase total is over $100.
qualifies_for_discount? = is_club_member? OR purchase_total > 100.00

! Calculate the final price using the operators
if qualifies_for_discount? then
  discount_rate = 0.10 ! 10% discount
  discount_amount = purchase_total * discount_rate
  final_price = purchase_total - discount_amount
  print "Discount applied! Final Price: $"; final_price
else
  print "No discount applied. Final Price: $"; purchase_total
end if

delay
---- output
Customer is a club member:  0 
Purchase total: $ 120 
Number of items:  3 

Discount applied! Final Price: $ 108

==== u1328_conditionals_5915 | conditionals | tutorial.txt line 5915 | expected: none
! --- Putting It All Together: Game Character Check ---

! Try changing these values to see different outcomes
health = 85
status$ = "Normal"
has_key? = true

print "--- Character Status ---"
print "Health: "; health
print "Status: "; status$
print "Has Key: "; has_key?
print

! 1. Check health status
if health < 10 then
  print "Health is CRITICAL!"
elseif health < 50 then
  print "Health is getting low."
else
  print "Health is good."
end if

! 2. Check if the character can open a special door
! The character needs full health AND the key to open it.
if health >= 100 AND has_key? then
  print "You can open the treasure door!"
else
  print "The treasure door remains locked."
end if

! 3. Check for special status effects
select case status$
  case "Poisoned"
    print "You are losing health each turn."
  case "Hasted"
    print "You are moving faster than normal!"
  case "Normal"
    ! Do nothing special
  case else
    print "An unknown effect is active."
end select

delay
---- output
--- Character Status ---
Health:  85 
Status: Normal
Has Key:  1 

Health is good.
The treasure door remains locked.

==== u1330_arrays_7652 | arrays | tutorial.txt line 7652 | expected: none
! --- Putting It All Together: A Dynamic Grocery List ---

! 1. Create an expandable string array to hold our grocery items.
dim grocery_list$(*)

print "Let's go shopping!"

! 2. Add items to the list by assigning to (*).
grocery_list$(*) = "Apples"
grocery_list$(*) = "Oranges"
grocery_list$(*) = "Bananas"

print "Initial list has "; size(grocery_list$); " items."

! 3. Add a few more items.
grocery_list$(*) = "Milk"
grocery_list$(*) = "Cereal"
print "The last item added was: "; grocery_list$(*)

print
print "--- Final Grocery List ---"
! 4. Loop through the final list and print each item.
for i = 1 to size(grocery_list$)
  print i; ". "; grocery_list$(i)
next i

delay
---- output
Let's go shopping!
Initial list has  3  items.
The last item added was: Cereal

--- Final Grocery List ---
 1 . Apples
 2 . Oranges
 3 . Bananas
 4 . Milk
 5 . Cereal

==== u1331_array_math_10562 | array_math | tutorial.txt line 10562 | expected: none
! Array math: a best-fit trend line through six months of sales
dim design(6, 2)                  ! one row per month: (month, 1)
fill design with 1, 1,  2, 1,  3, 1,  4, 1,  5, 1,  6, 1
dim sales(6)
fill sales with 13, 13, 15, 19, 20, 22

dim fit(*)
fit = solve(matmul(transpose(design), design), matmul(transpose(design), sales))
print "slope, intercept: "; fit
print "month 7 forecast:  "; fit(1) * 7 + fit(2)

! and the cafe's prices from two days of takings
dim cafe(2, 2)
fill cafe with 30, 20, 25, 30
dim takings(2)
fill takings with 130, 145
print "coffee, muffin:    "; solve(cafe, takings)

! exact decimal: 0.1 * 3 IS 0.3
dim d(3)
fill d with 0.1, 0.2, 0.3
print "d * 3 = 0.3 mask:  "; d * 3 = 0.3

! shapes, masks and strings
dim scores(*)
fill scores with 55, 72, 38, 90, 61
print "passing:           "; filter(scores, scores >= 60)
print "as a 2 x 3 grid:"
print reshape(scores, 2, 3)
dim names$(*)
fill names$ with "ann", "bob", "cy", "dee", "eve"
print "who passed:        "; filter(names$, scores >= 60)
print "names, 2 x 2, transposed:"
print transpose(reshape(names$, 2, 2))

! functions over arrays, index lists, sortindex, masks, split/join$
print "abs(d - 0.2):      "; abs(d - 0.2)
print "upper names:       "; ucase$(names$)
dim cut(*)
fill cut with 1, 2, 1, 3, 2
print "each cut to size:  "; left$(names$, cut)
print "piped:             "; names$ |> ucase$() |> left$(cut)
dim ages(*)
fill ages with 31, 25, 40, 25, 19
print "youngest first:    "; names$[sortindex(ages)]
print "ages sorted:       "; sort(ages)
ages = sort(ages, descending: true)
print "oldest first:      "; ages
scores(scores < 60) = 0
print "failing zeroed:    "; scores
dim words$(*)
words$ = trim$(split("apple, pear ,fig"))
print "joined sorted:     "; join$(sort(words$), " < ")

delay
---- output
slope, intercept:  2  10
month 7 forecast:   24 
coffee, muffin:     2.5  2.75
d * 3 = 0.3 mask:  1  0  0
passing:           72  90  61
as a 2 x 3 grid:
55  72  38
90  61   0
who passed:        bob  dee  eve
names, 2 x 2, transposed:
ann  cy
bob  dee
abs(d - 0.2):      0.1    0  0.1
upper names:       ANN  BOB  CY   DEE  EVE
each cut to size:  a    bo   c    dee  ev
piped:             A    BO   C    DEE  EV
youngest first:    eve  bob  dee  ann  cy
ages sorted:       19  25  25  31  40
oldest first:      40  31  25  25  19
failing zeroed:     0  72   0  90  61
joined sorted:     apple < fig < pear

==== u1332_maximize_and_minimize_11265 | maximize_and_minimize | tutorial.txt line 11265 | expected: none
! the woodshop: try changing the boards on hand, or whole to decimal
maximize profit = 35 * benches + 15 * stools
  where benches, stools are whole
  subject to
    boards:   5 * benches + 2 * stools <= 29    ! oak boards on hand
    hours:    2 * benches + 6 * stools <= 36    ! shop hours this week
end maximize
print 'Build '; benches; ' benches and '; stools; ' stools'
print 'Profit: '; profit

delay
---- output
Build  5  benches and  2  stools
Profit:  205

==== u1333_outer_product_11523 | outer_product | tutorial.txt line 11523 | expected: none
! outer(): every element of x against every element of y
dim x(4), y(3)
fill x with seq(1, 4)
fill y with seq(1, 3)

print "the times table, x down the rows and y across:"
print outer(x, y, *)
print
print "the addition table:"
print outer(x, y, +)
print
print "which x are bigger than which y (a 1/0 mask):"
print outer(x, y, >)
print "pairs where x > y: "; stats$sum(outer(x, y, >))
print

print "a built-in per pair -- the parentheses say outer does the calling:"
print outer(x, y, max())
print
print "an extra inside the parentheses fills parameter three: clamp(x, y, 3)"
print outer(x, y, clamp(3))
print

print "your own routine per pair:"
print outer(x, y, half_sum())
print

dim words$(2), lengths(3)
fill words$ with "banana", "cherry"
fill lengths with 1, 2, 3
print "every word against every length: left$()"
print outer(words$, lengths, left$())
print

dim names$(3)
fill names$ with "hello", "jello", "world"
print "a similarity matrix: compare() gives a number per pair"
print outer(names$, names$, compare())

delay

routine half_sum with a, b, returning h
  h = (a + b) / 2
end routine
---- output
the times table, x down the rows and y across:
 1   2   3
 2   4   6
 3   6   9
 4   8  12

the addition table:
2  3  4
3  4  5
4  5  6
5  6  7

which x are bigger than which y (a 1/0 mask):
0  0  0
1  0  0
1  1  0
1  1  1
pairs where x > y:  6 

a built-in per pair -- the parentheses say outer does the calling:
1  2  3
2  2  3
3  3  3
4  4  4

an extra inside the parentheses fills parameter three: clamp(x, y, 3)
1  2  3
2  2  3
3  3  3
3  3  3

your own routine per pair:
  1  1.5    2
1.5    2  2.5
  2  2.5    3
2.5    3  3.5

every word against every length: left$()
b    ba   ban
c    ch   che

a similarity matrix: compare() gives a number per pair
100   92    0
 92  100    0
  0    0  100

==== u1334_reduce_scan_11787 | reduce_scan | tutorial.txt line 11787 | expected: none
! reduce() and scan(): fold an array left to right
dim v(*)
fill v with 3, 1, 6, 2, 5

print "reduce(v, +) = "; reduce(v, +)
print "reduce(v, *) = "; reduce(v, *)
print "reduce(v, max()) = "; reduce(v, max())
print "reduce(v, -) = "; reduce(v, -); "   -- left to right: ((((3 - 1) - 6) - 2) - 5)"
print
print "scan(v, +)     = "; scan(v, +)
print "scan(v, max()) = "; scan(v, max())
print

dim names$(*)
fill names$ with "apples", "pears", "oranges"
print "reduce(names$, +) = "; reduce(names$, +)
print "reduce(names$, longer_of$()) = "; reduce(names$, longer_of$())
print

dim mask(*)
mask = v > 2
print "all above 2? "; reduce(mask, and); "   any above 2? "; reduce(mask, or)
print

dim g(2, 3)
fill g with 1, 2, 3, 4, 5, 6
print "reduce(g, +)         = "; reduce(g, +)
print "reduce(g, +, axis: 2) = "; reduce(g, +, axis: 2)
print "reduce(g, +, axis: 1) = "; reduce(g, +, axis: 1)
print "scan(g, +, axis: 2):"
print scan(g, +, axis: 2)
print

dim x(4), y(3)
fill x with seq(1, 4)
fill y with seq(1, 3)
print "the times table summed: "; reduce(outer(x, y, *), +, all: true)
print "pairs with x > y:       "; reduce(outer(x, y, >), +, all: true)
print

dim big(*)
fill big with seq(1, 100_000)
print "100000! = "; reduce(big, *)

delay

routine longer_of$ with a$, b$, returning r$
  if len(b$) > len(a$) then r$ = b$ else r$ = a$
end routine
---- output
reduce(v, +) = 17
reduce(v, *) = 180
reduce(v, max()) = 6
reduce(v, -) = -11   -- left to right: ((((3 - 1) - 6) - 2) - 5)

scan(v, +)     =  3   4  10  12  17
scan(v, max()) = 3  3  6  6  6

reduce(names$, +) = applespearsoranges
reduce(names$, longer_of$()) = oranges

all above 2? 0   any above 2? 1

reduce(g, +)         =  6  15
reduce(g, +, axis: 2) =  6  15
reduce(g, +, axis: 1) = 5  7  9
scan(g, +, axis: 2):
 1   3   6
 4   9  15

the times table summed: 60
pairs with x > y:       6

100000! = 2.824229407960347874293421578024535518477494926091224850578917944e+456573

==== u1335_complex_numbers_12326 | complex_numbers | tutorial.txt line 12326 | expected: none
! Processing complex numbers: an AC circuit, a rotation, and a line of the Mandelbrot set

volts = 120 + 0i
impedance = 40 + (30 - 10) * 1i
current = volts / impedance
print "impedance "; impedance; "  current "; current
print "amps "; round(abs(current), 4); "  phase "; round(arg(current) * 180 / pi, 2); " degrees"
apparent = volts * conj(current)
print "watts "; round(real(apparent), 2); "  vars "; round(imag(apparent), 2); "  VA "; round(abs(apparent), 2)
print

point = 3 + 1i
print "quarter turn "; point * 1i; "  half turn "; point * 1i * 1i
print "30 degrees   "; point * complex(cos(pi / 6), sin(pi / 6))
print

third = (1 + 2i) / 3
print "16 digits  "; third
print "30 digits  "; sprintf$("%.30r", third)
print

for row = 0 to 6
  line$ = ""
  for col = -20 to 10
    cc = complex(col / 10, (3 - row) * 0.3)
    if escape_count(c = cc) >= 50 then line$ = line$ + "#" else line$ = line$ + "."
  next col
  print line$
next row

delay

routine escape_count with c, returning n
  zz = 0 + 0i
  n = 0
  do while n < 50
    zz = zz * zz + c
    if abs(zz) > 2 then exit do
    n = n + 1
  loop
end routine
---- output
impedance  40+20i   current  2.4-1.2i 
amps  2.6833   phase -26.57  degrees
watts  288   vars  144   VA  321.99 

quarter turn -1+3i   half turn -3-1i 
30 degrees    2.098076211353317+2.366025403784439i 

16 digits   0.3333333333333333+0.6666666666666667i 
30 digits  0.333333333333333333333333333333+0.666666666666666666666666666667i

...............................
...............#.#####.........
..............##########.......
#######################........
..............##########.......
...............#.#####.........
...............................

==== u1337_clusters_15708 | clusters | tutorial.txt line 15708 | expected: none
cluster meals: protein$, liquid$, carb$

cluster breakfast using meals
  breakfast->protein$ = "Eggs"
  breakfast->liquid$ = "Tea"
  breakfast->carb$ = "Toast"

cluster lunch using meals
  lunch->protein$ = "Chicken"
  lunch->liquid$ = "Coffee"
  lunch->carb$ = "Rice"

cluster dinner using meals
  dinner->protein$ = "Steak"
  dinner->liquid$ = "Wine"
  dinner->carb$ = "Potatoes"

print cluster dinner, list

delay
---- output
--- Row 0 ---
DINNER->PROTEIN$ = "Steak" (5)
DINNER->LIQUID$ = "Wine" (4)
DINNER->CARB$ = "Potatoes" (8)

==== u1338_cluster_arrays_16909 | cluster_arrays | tutorial.txt line 16909 | expected: none
! Define the inventory cluster
cluster inventory: item_id$, product_name$, quantity, price

! Populate with some data
add cluster inventory: inventory->item_id$ = "WID-001", inventory->product_name$ = "Standard Widget", inventory->quantity = 150, inventory->price = 19.99
add cluster inventory: inventory->item_id$ = "GAD-002", inventory->product_name$ = "Super Gadget", inventory->quantity = 75, inventory->price = 29.95
add cluster inventory: inventory->item_id$ = "DOO-003", inventory->product_name$ = "Doodad Pro", inventory->quantity = 200, inventory->price = 9.50

! 1. Demonstrate accessing the "current" row
print "The last item added was: "; inventory->product_name$
print

! 2. Demonstrate updating a record
print "Updating Super Gadget quantity..."
row_num = findrow(inventory->product_name$, "Super Gadget")
inventory->quantity = 70
print "New quantity for Super Gadget: "; inventory->quantity
print

! 3. Demonstrate iterating and sorting with filtering
print "Inventory items with low stock (< 100), sorted by name:"
collect cluster inventory
  include inventory->quantity < 100
  sort by inventory->product_name$
end collect
for each inventory
  print inventory->product_name$; " (Quantity: "; inventory->quantity; ")"
next inventory
print

! 4. Demonstrate aggregation functions
print "Total of all stock: $"; stats$sum(inventory->quantity)
print "Highest quantity item: "; stats$max(inventory->quantity)
print

! 5. Demonstrate a failed search
item_to_find$ = "Mega Gizmo"
row_num = findrow(inventory->product_name$, item_to_find$)
if row_num = 0 then
  print item_to_find$; " was not found in the inventory."
end if

delay
---- output
The last item added was: Doodad Pro

Updating Super Gadget quantity...
New quantity for Super Gadget:  70 

Inventory items with low stock (< 100), sorted by name:
Super Gadget (Quantity:  70 )

Total of all stock: $ 420 
Highest quantity item:  200 

Mega Gizmo was not found in the inventory.

==== u1339_Sheerpower_statistics_18430 | Sheerpower_statistics | tutorial.txt line 18430 | expected: none
// Statistics on a plain array -- eight test scores
dim scores(*)
fill scores with 72, 85, 90, 64, 58, 95, 78, 81
print 'mean       '; stats$mean(scores)
print 'median     '; stats$median(scores)
print 'highest    '; stats$max(scores); '   lowest '; stats$min(scores)
print 'spread     '; stats$stddev(scores)
print 'passed     '; stats$sum(scores >= 60); ' of '; size(scores)
print 'above mean '; filter(scores, scores > stats$mean(scores))
dim hours(*)
fill hours with 4, 6, 8, 3, 2, 9, 5, 6
print 'correlation '; stats$pcorr(hours, scores)
dim names$(*)
fill names$ with 'apples', 'pears', 'blueberrys', 'oranges'
print 'longest name len '; names$ |> len() |> stats$max()
dim dice(*)
fill dice with 1000 of rnd(6)
print 'mean of 1000 rolls '; stats$mean(dice); '   sixes '; stats$sum(dice = 6)
print

cluster sample: value1, value2

// Populate sample data (e.g., 1 to 100 for value1, reversed
// for value2)
for i = 1 to 100
add cluster sample
sample->value1 = i
sample->value2 = 101 - i
end add
next i

start timer
// Example usage of all statistical functions
print "Basic Descriptive Statistics"
print 'Max value: '; stats$max(sample->value1)
print 'Min value: '; stats$min(sample->value1)
print 'Range: '; stats$range(sample->value1)
print 'Sum: '; stats$sum(sample->value1)
print 'Mean (Average): '; stats$mean(sample->value1)
print 'Median: '; stats$median(sample->value1)
print 'Mode: '; stats$mode(sample->value1)
print 'Midrange: '; stats$midrange(sample->value1)

print "Dispersion & Distribution Metrics"
print 'Standard Deviation (sample): '; stats$stddev(sample->value1)
print 'Standard Deviation (population): '; stats$stddev(sample->value1, 1)
print 'Variance (sample): '; stats$var(sample->value1)
print 'Variance (population): '; stats$var(sample->value1, 1)
print 'Interquartile Range: '; stats$iqr(sample->value1)
print 'Coefficient of Variation: '; stats$cv(sample->value1)
print 'Median Abs Deviation: '; stats$mad(sample->value1)
print 'Standard Error of Mean: '; stats$sem(sample->value1)

print "Percentiles & Risk Measures"
print '50th Percentile (Median): '; stats$percentile(sample->value1, 50)
print '2.5th Percentile: '; stats$percentile(sample->value1, 2.5)
print '97.5th Percentile: '; stats$percentile(sample->value1, 97.5)
print 'Z-score (for 50): '; stats$zscore(sample->value1, 50)
print 'Drawdown: '; stats$drawdown(sample->value1)
print 'Value at Risk (95%): '; stats$vrisk(sample->value1, 0.95)
print 'Conditional VaR (95%): '; stats$cvrisk(sample->value1, 0.95)

print "Skewness & Kurtosis (Shape of Distribution)"
print 'Skewness: '; stats$skew(sample->value1)
print 'Kurtosis: '; stats$kurtosis(sample->value1)
print 'FP Skewness (Sample): '; stats$fpskew_sample(sample->value1)
print 'Kurtosis (Sample): '; stats$kurtosis_sample(sample->value1)

print "Alternative Measures of Central Tendency"
print 'Geometric Mean: '; stats$gmean(sample->value1)
print 'Harmonic Mean: '; stats$hmean(sample->value1)

print "Statistical Tests & Inference"
print 'T-test (Welch): '; stats$ttest(sample->value1, sample->value2); &
      '   p-value (_real): '; _real
print 'Paired t-test: '; stats$ttest_paired(sample->value1, sample->value2); &
      '   p-value (_real): '; _real
print 'Chi-squared: '; stats$chi2(sample->value1, sample->value2); &
      '   p-value (_real): '; _real
print 'F-test: '; stats$ftest(sample->value1, sample->value2); &
      '   p-value (_real): '; _real

print "Regression & Correlation"
print 'Linear Regression Slope: '; stats$linreg(sample->value1, sample->value2); &
      '   intercept (_real): '; _real
print 'Pearson Correlation: '; stats$pcorr(sample->value1, sample->value2)
print 'Spearman Rho: '; stats$spearman(sample->value1, sample->value2)
print 'Covariance: '; stats$cov(sample->value1, sample->value2)

print "Finance & Risk Analysis"
print 'Sharpe Ratio (0%): '; stats$sharpe(sample->value1, 0)
print 'CAGR (2 years): '; stats$cagr(sample->value1, 2)
print 'Root Mean Square: '; stats$rms(sample->value1)

print "Additional Functions"
print '3rd Central Moment: '; stats$moment(sample->value1, 3)
print 'Trimmed Mean (10%): '; stats$trimmed_mean(sample->value1, 10)
print 'Weighted Mean: '; stats$weighted_mean(sample->value1, sample->value2)
print 'EMA (alpha 0.1): '; stats$ema(sample->value1, 0.1)
print 'Autocorrelation (lag 1): '; stats$autocorr(sample->value1)
print 'Rank of row 25: '; stats$rank(sample->value1, 25)
print 'Chi-square CDF(1.5, df 10): '; stats$cdf(1.5, 10)
print 'F CDF(2, df 10, 20): '; stats$fcdf(2, 10, 20)
print 'Normal CDF(1.96): '; stats$ncdf(1.96)
print 'Student-t CDF(2.1, df 10): '; stats$tcdf(2.1, 10)
print 'KS test D: '; stats$ks_test(sample->value1); &
      '   p-value (_real): '; _real

print "Error handling: no data RAISES instead of returning 0"
cluster empty_sample: v
when exception in
  print 'mean of empty cluster: '; stats$mean(empty_sample->v)
use
  print 'caught: '; extype; ' = '; exceptionname$(extype)
end when

print 'Time in seconds: '; _elapsed

delay
---- output
mean        77.875 
median      79.5 
highest     95    lowest  58 
spread      12.6653351430475098 
passed      7  of  8 
above mean 85  90  95  78  81
correlation  0.98475809258555 
longest name len  10 
mean of 1000 rolls  3.556    sixes  162 

Basic Descriptive Statistics
Max value:  100 
Min value:  1 
Range:  99 
Sum:  5050 
Mean (Average):  50.5 
Median:  50.5 
Mode:  1 
Midrange:  50.5 
Dispersion & Distribution Metrics
Standard Deviation (sample):  29.0114919758820171 
Standard Deviation (population):  28.866070047722118 
Variance (sample):  841.6666666666666667 
Variance (population):  833.25 
Interquartile Range:  49.5 
Coefficient of Variation:  0.5744849896214261 
Median Abs Deviation:  25 
Standard Error of Mean:  2.9011491975882017 
Percentiles & Risk Measures
50th Percentile (Median):  50.5 
2.5th Percentile:  3.475 
97.5th Percentile:  97.525 
Z-score (for 50): -0.0172345496886428 
Drawdown:  0 
Value at Risk (95%):  5 
Conditional VaR (95%):  3 
Skewness & Kurtosis (Shape of Distribution)
Skewness:  0 
Kurtosis: -1.2002400240024002 
FP Skewness (Sample):  0 
Kurtosis (Sample): -1.2 
Alternative Measures of Central Tendency
Geometric Mean:  37.9926893448343 
Harmonic Mean:  19.2775635973960052 
Statistical Tests & Inference
T-test (Welch):  0    p-value (_real):  1 
Paired t-test:  0    p-value (_real):  1 
Chi-squared:  32716.4380574417662807    p-value (_real):  0 
F-test:  1    p-value (_real):  0.99999999999999 
Regression & Correlation
Linear Regression Slope: -1    intercept (_real):  101 
Pearson Correlation: -1 
Spearman Rho: -1 
Covariance: -841.6666666666666667 
Finance & Risk Analysis
Sharpe Ratio (0%):  1.740689518552921 
CAGR (2 years):  9 
Root Mean Square:  58.16786054171152 
Additional Functions
3rd Central Moment:  0 
Trimmed Mean (10%):  50.5 
Weighted Mean:  34 
EMA (alpha 0.1):  91.0002656139888758 
Autocorrelation (lag 1):  1 
Rank of row 25:  25 
Chi-square CDF(1.5, df 10):  0.0010646777727858 
F CDF(2, df 10, 20):  0.91021728515625 
Normal CDF(1.96):  0.97500210485178 
Student-t CDF(2.1, df 10):  0.968961377898894 
KS test D:  0.0610367616051748    p-value (_real):  0.839074202981013 
Error handling: no data RAISES instead of returning 0
mean of empty cluster: caught: -4107  = MSG_NOSTATISTIC
Time in seconds:  0.282

==== u1340_searching_cluster_data_19485 | searching_cluster_data | tutorial.txt line 19485 | expected: none
a$ = 'Banana'
b$ = 'der Apfel'
// simple translation dictionary
cluster trans: english$, german$
add cluster trans: english$ = 'apple',  german$ = 'der Apfel'
add cluster trans: english$ = 'banana', german$ = 'die Banane'

word$ = a$

do
  // First, try translating English to German
  row = findrow(trans->english$, word$)
  if row > 0 then
    print word$;' >> '; trans->german$
    exit do
  end if
  
  // Not found as English, try German
  row = findrow(trans->german$, word$)
  if row > 0 then
    print word$;' >> '; trans->english$
    exit do
  end if
      
  print 'No translation for '; word$

end do // a single iteration loop

delay
---- output
Banana >> die Banane

==== u1341_cluster_as_a_dictionary_19599 | cluster_as_a_dictionary | tutorial.txt line 19599 | expected: none
// An example of using a cluster as a simple <b>Key/Value</b> pair Data Dictionary
// Note:  All cluster variables can be used as keys

cluster capitals: country$, city$

add cluster capitals
  capitals->country$ = 'USA'
  capitals->city$    = 'Washington, D.C.'

add cluster capitals: capitals->country$ = 'Germany',
            capitals->city$    = 'Berlin'
          
add cluster capitals: capitals->country$ = 'China', capitals->city$    = 'Beijing'

row = findrow(capitals->country$, 'Germany')
if row = 0 then
  print 'Unknown'
else
  print capitals->city$
end if

row = findrow(capitals->city$, 'Beijing')
if row = 0 then
  print 'Unknown'
else
  print capitals->country$
end if

delay
---- output
Berlin
China

==== u1342_cluster_spreadsheets_20330 | cluster_spreadsheets | tutorial.txt line 20330 | expected: none
a$ = 'Duluth'
cluster cities: City$, Country$, Population, Region$, Latitude, Longitude

cluster input name '@..\safe\safe_world_cities.csv', headers 1: cities
print 'cities input: '; size(cities)
print

mycity$ = a$ 
do
  row = findrow(cities->city$, mycity$)
  if row = 0 then
    print 'Unknown city: ['; mycity$;'] Try a different value for a$ -- like Duluth'
    exit do
  end if
  print sprintf$('Population of %s is %m', mycity$, cities->population)
end do

collect cluster cities
  include cities->population > 10_000_000 // try other values
  sort nocase by cities->city$
end collect
for each cities
  print cities->city$;' '; cities->country$;
  print sprintf$(', population %m', cities->population)
next cities

print "=== CSV formatted, with headers ==="
ask cluster cities: headers headers$
print headers$
for each cities
  print cluster cities
next cities

delay
---- output
cities input:  9268 

Population of Duluth is 84,800
Bombay IN, population 12,692,717
Delhi IN, population 10,928,270
Karachi PK, population 11,627,378
Manila PH, population 10,443,877
Moscow RU, population 10,381,288
New Delhi IN, population 10,928,270
Sao Paulo BR, population 10,021,437
Seoul KR, population 10,323,448
Shanghai CN, population 14,608,512
Tokyo JP, population 31,480,498
=== CSV formatted, with headers ===
CITY,COUNTRY,POPULATION,REGION,LATITUDE,LONGITUDE
"Bombay","IN",12692717,"16",18.975,72.825833
"Delhi","IN",10928270,"7",28.666667,77.216667
"Karachi","PK",11627378,"5",24.9056,67.0822
"Manila","PH",10443877,"D9",14.6042,120.9822
"Moscow","RU",10381288,"48",55.752222,37.615556
"New Delhi","IN",10928270,"7",28.6,77.2
"Sao Paulo","BR",10021437,"27",-23.473293,-46.665803
"Seoul","KR",10323448,"11",37.5985,126.9783
"Shanghai","CN",14608512,"23",31.045556,121.399722
"Tokyo","JP",31480498,"40",35.685,139.751389

==== u1343_text_analysis_20512 | text_analysis | tutorial.txt line 20512 | expected: none
a$ = 'y,z'
open file in_ch: name '@..\safe\safe_bible.txt'

cluster raw_bible: location$, text$
cluster words: location$, word$

// skip copyright headers, etc., there are three of them
for idx = 1 to 3
  line input #in_ch, eof eof?: temp$
next idx

do
  line input #in_ch, eof eof?: rec$
  if eof? then exit do
  add cluster raw_bible
    raw_bible->location$ = piece$(rec$, 1, chr$(9))
    raw_bible->text$     = piece$(rec$, 2, chr$(9))
  end add
loop
close #in_ch
print 'Bible text lines: '; size(raw_bible)

collect cluster raw_bible
  text$ = raw_bible->text$
  // Within each text line, get each word
  // skip those which are numbers or are proper names
  for idx = 1
    word$ = getword$(text$, idx)
    if word$ = '' then exit for
    first$ = word$[1:1]
    if  (first$ >= '0' and first$ <= '9') or
        (first$ >= 'A' and first$ <= 'Z') then iterate for
    // subset the list to certain letters (separated by commas)
    if len(a$) > 0 and match(a$, first$) = 0 then iterate for
    add cluster words
      words->location$ =raw_bible->location$
      words->word$ = word$
    end add
  next idx
  
end collect

print 'First letters to include: '; a$
print 'Total words: '; size(words)
print

// Using the unique words, get the ones that occur just once
collect cluster words: unique words->word$
  include _extracted = 1 // just one occurrence
  sort by words->word$
end collect
print 'Words selected: '; _extracted
print

for each words
  
  row = findrow(raw_bible->location$, words->location$)
  assert row > 0, 'We should always find the location'
  text$ = replace$(raw_bible->text$, words->word$+'='+'[['+words->word$+']]')

  print raw_bible->location$
  print change$(wrap$(text$, 5, 70), chr$(13), '') // pretty it up
  print

next words

delay
---- output
Bible text lines:  31102 
First letters to include: y,z
Total words:  18254 

Words selected:  39 

John 21:8
    The other disciples came ashore in the boat. They dragged in the 
    net full of fish, for they were not far from land, only about a 
    hundred [[yards]].

1 Kings 3:26
    Then the woman whose son was alive spoke to the king because she 
    [[yearned]] with compassion for her son. Please, my lord, she 
    said, give her the living baby. Do not kill him! But the other 
    woman said, He will be neither mine nor yours. Cut him in two!

Isaiah 63:15
    Look down from heaven and see, from Your holy and glorious 
    habitation. Where are Your zeal and might? Your [[yearning]] and 
    compassion for me are restrained.

Numbers 14:34
    In keeping with the forty days you spied out the land, you shall 
    bear your guilt forty [[yearsa]] year for each dayand you will 
    experience My alienation.

Psalm 90:10
    The length of our days is seventy [[yearsor]] eighty if we are 
    strongyet their pride is but labor and sorrow, for they quickly 
    pass, and we fly away.

Leviticus 25:8
    And you shall count off seven Sabbaths of yearsseven times seven 
    [[yearsso]] that the seven Sabbaths of years amount to 
    forty-nine years.

Leviticus 25:22
    While you are sowing in the eighth year, you will be eating from 
    the previous harvest, until the ninth [[years]] harvest comes in.

Jeremiah 51:46
    Do not let your heart grow faint, and do not be afraid when the 
    rumor is heard in the land; for a rumor will come one yearand 
    then another the next [[yearof]] violence in the land and of 
    ruler against ruler.

2 Samuel 16:5
    As King David approached Bahurim, a man from the family of the 
    house of Saul was just coming out. His name was Shimei son of 
    Gera, and as he approached, he kept [[yelling]] out curses.

2 Corinthians 1:17
    When I planned this, did I do it carelessly? Or do I make my 
    plans by human standards, so as to say Yes, [[yes]] when I 
    really mean No, no?

Philippians 4:3
    Yes, and I ask you, my true [[yokefellow]], to help these women 
    who have labored with me for the gospel, along with Clement and 
    the rest of my fellow workers, whose names are in the Book of 
    Life.

2 Samuel 24:22
    Araunah said to David, My lord the king may take whatever seems 
    good and offer it up. Here are the oxen for a burnt offering and 
    the threshing sledges and ox [[yokes]] for the wood.

Genesis 44:12
    The steward searched, beginning with the oldest and ending with 
    the [[youngestand]] the cup was found in Benjamins sack.

Genesis 46:34
    you are to say, Your servants have raised livestock ever since 
    our [[youthboth]] we and our fathers. Then you will be allowed 
    to settle in the land of Goshen, since all shepherds are 
    detestable to the Egyptians.

Isaiah 47:15
    This is what they are to youthose with whom you have labored and 
    traded from [[youtheach]] one strays in his own direction; not 
    one of them can save you.

Psalm 129:1
    A song of ascents. Many a time they have persecuted me from my 
    [[youthlet]] Israel now declare

1 Samuel 24:9
    and said to Saul, Why do you listen to the words of men who say, 
    Look, David intends to harm [[you]]?

2 Corinthians 10:1
    Now by the mildness and gentleness of Christ, I appeal to 
    [[youI]], Paul, who am humble when face to face with you, but 
    bold when away.

Deuteronomy 1:15
    So I took the leaders of your tribes, wise and respected men, and 
    appointed them as leaders over [[youas]] commanders of 
    thousands, of hundreds, of fifties, and of tens, and as officers 
    for your tribes.

Habakkuk 2:8
    Because you have plundered many nations, the remnant of the 
    people will plunder [[youbecause]] of your bloodshed against man 
    and your violence against the land, the city, and all their 
    dwellers.

Genesis 8:17
    Bring out all the living creatures that are with [[youbirds]], 
    livestock, and everything that crawls upon the groundso that 
    they can spread out over the earth and be fruitful and multiply 
    upon it.

1 Corinthians 7:21
    Were you a slave when you were called? Do not let it concern 
    [[youbut]] if you can gain your freedom, take the opportunity.

Nehemiah 6:10
    Later, I went to the house of Shemaiah son of Delaiah, the son of 
    Mehetabel, who was confined to his house. He said: Let us meet 
    at the house of God inside the temple. Let us shut the temple 
    doors because they are coming to kill [[youby]] night they are 
    coming to kill you!

Proverbs 27:27
    You will have plenty of goats milk to feed [[youfood]] for your 
    household and nourishment for your maidservants.

Genesis 32:6
    When the messengers returned to Jacob, they said, We went to 
    your brother Esau, and now he is coming to meet [[youhe]] and 
    four hundred men with him.

1 Thessalonians 2:18
    For we wanted to come to [[youindeed]] I, Paul, tried again and 
    againbut Satan obstructed us.

Isaiah 60:13
    The glory of Lebanon will come to [[youits]] cypress, elm, and 
    boxwood togetherto adorn the place of My sanctuary, and I will 
    glorify the place of My feet.

Song of Solomon 1:4
    Take me away with [[youlet]] us hurry! May the king bring me to 
    his chambers. We will rejoice and delight in you; we will praise 
    your love more than wine. It is only right that they adore you.

Jeremiah 3:14
    Return, O faithless children, declares the LORD, for I am your 
    master, and I will take [[youone]] from a city and two from a 
    familyand bring you to Zion.

2 Kings 10:23
    Next, Jehu and Jehonadab son of Rechab entered the temple of 
    Baal, and Jehu said to the servants of Baal, Look around to see 
    that there are no servants of the LORD here among [[youonly]] 
    servants of Baal.

2 Corinthians 8:7
    But just as you excel in everythingin faith, in speech, in 
    knowledge, in complete earnestness, and in the love we inspired 
    in [[yousee]] that you also excel in this grace of giving.

Isaiah 1:12
    When you come to appear before Me, who has required this of 
    [[youthis]] trampling of My courts?

Jeremiah 29:31
    Send a message telling all the exiles what the LORD says 
    concerning Shemaiah the Nehelamite. Because Shemaiah has 
    prophesied to [[youthough]] I did not send himand has made you 
    trust in a lie,

2 Corinthians 13:5
    Examine yourselves to see whether you are in the faith; test 
    yourselves. Cant you see for yourselves that Jesus Christ is in 
    [[youunless]] you actually fail the test?

2 Corinthians 9:4
    Otherwise, if any Macedonians come with me and find you 
    unprepared, weto say nothing of [[youwould]] be ashamed of 
    having been so confident.

Isaiah 47:13
    You are wearied by your many counselors; let them come forward 
    now and save [[youyour]] astrologers who observe the stars, who 
    monthly predict your fate.

Numbers 34:25
    Eli-[[zaphan]] son of Parnach, a leader from the tribe of Zebulun;

1 Chronicles 4:20
    The sons of Shimon: Amnon, Rinnah, Ben-hanan, and Tilon. The 
    descendants of Ishi: Zoheth and Ben-[[zoheth]].

1 Samuel 1:1
    Now there was a man named Elkanah who was from 
    Ramathaim-[[zophim]] in the hill country of Ephraim. He was the 
    son of Jeroham, the son of Elihu, the son of Tohu, the son of 
    Zuph, an Ephraimite.

==== u1344_embed_cluster_20660 | embed_cluster | tutorial.txt line 20660 | expected: none
 cluster fullname: first$, last$   
 cluster multi: ssn$, prefix cluster fullname, tax, is_okay?  
  
 add cluster multi   
   multi->ssn$     = '222-33-4444'   
   multi->fullname->first$   = 'Mister2 "they say"'   
   multi->fullname->last$    = 'Smith2'   
   multi->tax      = 45.678   
   multi->is_okay? = false   
 end add 
     
 print 'Current row json'   
 x$ =  json$(multi)   
 print change$(x$, chr$(13))
 print
 
 multi->fullname->first$   = 'Mister'   
 multi->fullname->last$    = 'Smith'  

cluster my_student: id$, address->addr1$, address->addr2$, address->city$, address->state$, address->zip$ 
my_student->id$ = 'John Henry' 
my_student->address->addr1$ = '23 Hummingbird Way'
my_student->address->addr2$ = 'Box 456' 
my_student->address->city$ = 'Escondido' 
my_student->address->state$ = 'CA' 
my_student->address->zip$ = '92345'   
x$ =  json$(my_student)  
print change$(x$, chr$(13))  
print

delay
---- output
Current row json
{
   "multi":
      {
      "ssn":"222-33-4444",
      "fullname": {
         "first":"Mister2 \"they say\"",
         "last":"Smith2"
         },
      "tax":45.678,
      "is_okay":false
      }
}


{
   "my_student":
      {
      "id":"John Henry",
      "address": {
         "addr1":"23 Hummingbird Way",
         "addr2":"Box 456",
         "city":"Escondido",
         "state":"CA",
         "zip":"92345"
         }
      }
}

==== u1345_priv_clusters_20713 | priv_clusters | tutorial.txt line 20713 | expected: none
 do_work with firstname$ = 'Sally'   
 do_work with firstname$ = 'Fred'   
 do_work with firstname$ = 'Tom'   
 do_work with firstname$ = 'Jane'   
 do_work with firstname$ = 'Julie'     
 print
 
 print cluster do_work$my_test: all

 delay

 private routine do_work with firstname$      
   cluster my_test: name$     
   add cluster my_test     
     my_test->name$ = firstname$  
   end add   
   print 'Rows: '; size(my_test)   
 end routine
---- output
Rows:  1 
Rows:  2 
Rows:  3 
Rows:  4 
Rows:  5 

NAME
"Sally"
"Fred"
"Tom"
"Jane"
"Julie"

==== u1346_copy_cluster_20761 | copy_cluster | tutorial.txt line 20761 | expected: none
 cluster student: name$, age, level    
 
 add cluster student   
   student->name$ = "Joan Ark"   
   student->age = 18   
   student->level = 12
 end add
 add cluster student   // this record will be "current"   
   student->name$ = "Desmond Jones"   
   student->age = 15   
   student->level = 10    
 end add
 cluster new_student using student    // creates a new cluster using the source as a template   
 copy cluster student to new_student  // copy only the "current" record from student to new_student   
 print cluster new_student: all       // print all the records with headers suppressed 
 print
 
 cluster new_student2 using student   //  creates  a  new  cluster  using  the  source  as  a  template 
 copy cluster student to new_student2 :  all //  copy  all  the  records 
 print  cluster new_student2 :  all //  print  all  the  records with  headers
 print

 add cluster new_student   // add one record 
   new_student->name$ = "Eric James"   
   new_student->age = 19   
   new_student->level = 12   
 end add 
 print cluster new_student: all     
 print     
 
 copy cluster student to new_student: append     
 print 'New cluster with records appended'   
 print cluster new_student: all

 delay
---- output
NAME,AGE,LEVEL

NAME,AGE,LEVEL
"Joan Ark",18,12
"Desmond Jones",15,10

NAME,AGE,LEVEL
"Eric James",19,12

New cluster with records appended
NAME,AGE,LEVEL
"Eric James",19,12
"Joan Ark",18,12
"Desmond Jones",15,10

==== u1347_enum_21489 | enum | tutorial.txt line 21489 | expected: none
enum season: spring, summer, fall, winter 
print season->summer 
print enum season

print
enum season2 using season 
print enum season2, list

delay
---- output
 2 
1,2,3,4

--- Row 0 ---
SEASON2->SPRING = 1
SEASON2->SUMMER = 2
SEASON2->FALL = 3
SEASON2->WINTER = 4

==== u1348_strings_22167 | strings | tutorial.txt line 22167 | expected: none
fullname$ = 'Sally Sue'
sentence$ = fullname$ + ' was here.'
print sentence$
sentence$ = 'So I heard.'
print sentence$

first$ = 'John'
last$ = "Smith"

full$ = first$ + ' ' + last$
Print 'Full name: '; full$

print getword$(full$, 2)

bible$ = fileinfo$('@..\safe\safe_bible.txt', 'contents')
print 'Length of bible$:'; len(bible$)
print

for idx = 1007 to 1019
  print getword$(bible$, idx); ' ';
next idx
print

print between$(bible$, 'rain upon', 'ground')
print

// A %text block is one multi-line string literal, exactly as typed
memo$ = %text
   Shipping Note
     // handle with care
   123 Main Street
%end text
print memo$
print 'Memo is '; len(memo$); ' characters'

! f$(): the sentence as you would say it, values in place
who$ = 'Sally'
age = 22
print f$('Her name was [[who$]], she was [[age]] old.')
print f$('[[ucase$(who$)]] has [[len(who$)]] letters; next year [[age + 1]]')

delay
---- output
Sally Sue was here.
So I heard.
Full name: John Smith
Smith
Length of bible$: 4259967 

for the LORD God had not yet sent rain upon the earth and 
 the earth, and there was no man to cultivate the 

   Shipping Note
     // handle with care
   123 Main Street
Memo is  62  characters
Her name was Sally, she was 22 old.
SALLY has 5 letters; next year 23

==== u1349_string_functions_25455 | string_functions | tutorial.txt line 25455 | expected: none
mybuf$ = space$(1024)
subtext$ = 'abcde'
start_pos = 1
for idx = 1 to 10
  start_pos = overlay(mybuf$, subtext$, start_pos)
next idx
print left$(mybuf$, 50)

numbers$ = ''
for i = 1 to 100_000
  newlen = join(numbers$, str$(i), ' ')
next i
print 'Length: '; len(numbers$)
print 'Elapsed: '; _elapsed

a$ = 'abcdefg'
print a$[2:6]

print ascii('A')

print base64encode$('sure')

print base64decode$('c3VyZQ==')

print change$('bdbdbdbd', 'b', 'c')

print chr$(65,10)

print cpad$('123', 9, '0')

print edit$('this   is   a   test', 16+32)

print elements('dog|| cat|| bird', '||')
print element$('dog|| cat|| bird', 2, '||')

print encode$(20, 16)
print encode$(20, 2)

print format$('5551234567', '(###)~ ###~-####')
print format$(12.239, '##.##')

print geodistance('37.423021,-122.083739', '42.730287,-73.692511')

print getword$('123rd Baker Street Apt 200', 2)

print _gid$

print lcase$('IT HAS BEEN A WONDERFUL DAY!')

print left$('1234567890', 5)
print left$('1234567890', -3)

print len('1234567890')

print lpad$('123', 9, '0')

print ltrim$('    hey hey')

print _integer

print mid$('beginmiddleend', 6, 6)
print mid$('beginmiddleend', 6)

print 'parse()>> '; parse$('company$ = 123abc$ + "and sons"')

print phash$('my password')
print phash$('my passwerd')

print repeat$('hi ', 5)

print replace$('01-Mar-1989', 'Mar=Jun')

print right$('Daniel', 2)

print rpad$('123', 9, '0')

print 'rtrim$("  hi there   ")>> '; '['; rtrim$('  hi there    '); ']'

print seg$('abcdefghijklmnop', 3, 8)

print 'space$()>> '; '['; space$(5); ']'

print 'str$(15)>> '; "I am " + str$(15) + " years old."

print 'trim$("  hi there   ")>> '; '['; trim$('  hi there    '); ']'

print ucase$('Having fun?')

print unique$('aaabbccc d e f')

print uuid$
print uuid$(3)

print val('4.567')
print val("I have 12 cats", 0) // extract any valid number, returns zero otherwise

delay
---- output
abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde
Length:  588895 
Elapsed:  0.047 
bcdef
 65 
c3VyZQ==
sure
cdcdcdcd
AAAAAAAAAA
000123000
THIS IS A TEST
 3 
cat
14
10100
(555) 123-4567
12.24
 2555.453 
Baker
20261016eYAuhRRZHEOX9H5UvFficA
it has been a wonderful day!
12345
1234567
 10 
000000123
hey hey
 7 
middle
middleend
parse()>> COMPANY$ = 123ABC$ + "and sons"
jnQiu3h83Y4pwkhJZQd-GY4p
hHQiu3h83Y6_m-gZuW-o24S_
hi hi hi hi hi 
01-Jun-1989
el
123000000
rtrim$("  hi there   ")>> [  hi there]
cdefgh
space$()>> [     ]
str$(15)>> I am 15 years old.
trim$("  hi there   ")>> [hi there]
HAVING FUN?
abc def
hYzPmrUYnUqncm8VZqZGPg
{69B10D24-E24B-4198-9355-0C17ADA55EA9}
 4.567 
 0

==== u1350_string_views_26764 | string_views | tutorial.txt line 26764 | expected: none
// Read entire log file into memory - ONE ALLOCATION
contents$ = fileinfo$("@..\safe\access.log", "contents")
sep$      = chr$(13) + chr$(10)
//
// These views are updated only when used: they only rebind (re-search delimiters) when referenced,
// and only if their source (line$) has changed. Within one line, repeated use
// of the same view reuses cached positions -- no extra work.
// Declaring views outside the loop is safe: they rebind automatically when line$ changes.
  // Major quoted regions
  view ts$  into line$ between "[", "]" notrim
  view req$ into line$ between chr$(34), chr$(34) match 1 notrim // chr$(34) = double quote
  view ref$ into line$ between chr$(34), chr$(34) match 2 notrim
  view ua$  into line$ between chr$(34), chr$(34) match 3 notrim
//
  // Request is: METHOD space PATH space PROTOCOL
  view method$ into req$ piece " " match 1
  view path$   into req$ piece " " match 2
  view proto$  into req$ piece " " match 3
//
  // Fast filter example
//
// Iterate forever; exit when no more lines
for i = 1 // no upper bound
//
  // Zero-copy view of the i-th line -- no memory is allocated
  view line$ into contents$ piece sep$ match i
  z = len(line$)        // forces VIEW resolve; if MATCH fails, VIEW sets _integer = -1
  if _integer = -1 then exit for  // MATCH not found => EOF
//
  if method$ = "GET" and contains(path$, "/api/") then
    counter++
  end if
//
next i
// Total memory allocations - ONE ALLOCATION
//
//
print 'done -- API GET count:'; counter

delay
---- output
done -- API GET count: 0

==== u1351_string_searching_27375 | string_searching | tutorial.txt line 27375 | expected: none
print compare('broadcast', 'braodcast')  // returns the probability that the two strings match

print item('ADD,EXIT,EXTRACT,MODIFY', 'MOD')

print match('Red, White, Blue', 'blue')

print matchword('I have No Service today', 'no service')

print pattern('The quick brown fox', 'f?x')

print pos('Hello and goodbye', 'nd')

print regexreplace$('is raining', 'rain', 'snow')
print regexsearch('is raining', 'rain')

print scan('Cameron Whitehorn', 'amr Wtor')

print skip('31415 hello', '1234567890 ')

delay
---- output
 96 
 4 
 3 
 8 
 17 
 8 
is snowing
 4 
 2 
 7

==== u1352_regular_expressions_27827 | regular_expressions | tutorial.txt line 27827 | expected: none
text$ = 'it is raining outside'
expr$ = 'rain'
starting = regexsearch(text$, expr$)
print mid(text$, starting, _integer)

text$ = '505-555-1212'
expr$ = '(\d{3})-(\d{3})-(\d{4})'
for idx = 0 to 999
  starting = regexsearch(text$, expr$,idx)
  if starting = 0 then exit for
  print idx, mid(text$, starting, _integer)
next idx

text$ = 'it is raining outside'
expr$ = 'rain'
print regexreplace$(text$, expr$, 'snow')

text$ = 'I am 39 years old'
expr$ = '(\d+)'
starting = regexsearch(text$, expr$, 1)

print 'The age is '; mid(text$, starting, _integer)
text$[starting:starting+_integer-1] = '65' // change the age to 65
print text$

delay
---- output
rain
 0 505-555-1212
 1 505
 2 555
 3 1212
it is snowing outside
The age is 39
I am 65 years old

==== u1353_sprintf_28604 | sprintf | tutorial.txt line 28604 | expected: none
age = 33
years = 33
name$ = "Sally Sue"

print f$('Next year she will be [[years + 1]].')
print f$('First three letters: [[left$(name$, 3)]]')
print f$('Uppercase name: [[ucase$(name$)]]')

print sprintf$('Age is %', age)

name$ = 'Sally Sue'
age = 22
their_date$ = 'July 7'
note$ = sprintf$('% is % on %', name$, age, their_date$)
print 'Here is my note: '; note$

print sprintf$('PI is about %.3f', 3.14159265)

ox_counter = 56
print sprintf$('I have % %p.', ox_counter, 'ox')

ox_counter = 1
print sprintf$('I have % %p.', ox_counter, 'ox')

print sprintf$('%p', 'foot')

  cash = 1234567.887
print sprintf$('About $ %.2m', cash)

print sprintf$('The letter (\0102)')

ssn$ = '123456789'
print sprintf$('%z SSN: @@@-@@-@@@@', ssn$)
print sprintf$('%z SSN: [1:3]-[4:5]-[6:9]', ssn$)

a$='abcdefGHI'
print sprintf$('%z [uc:1:3]-[4:5]-[lc:6:end]', a$)

print sprintf$('The age was: %h%i', 15, 39 )

print sprintf$('Number: %10i and more.', 123)
print sprintf$('Number: %-10i and more.', 123)

print sprintf$('%i in Octal: %o  Hex: %x  Binary: %b', 123, 123, 123, 123)

f$ = "%tThe party is @month (month @mm) @dd, @yyyy @mt:@m2:@s2 - or @h2:@m2:@s2 @ampm on a @day"
now_secs = seconds('')
print sprintf$(f$, now_secs)

print sprintf$('%t@month @dd2-@mon-@yyyy', seconds('20221225 0000'))

print sprintf$('%t@mil Processing starting')

print sprintf$('%t@short Processing starting')

print sprintf$('%t Processing started')

delay
---- output
Next year she will be 34.
First three letters: Sal
Uppercase name: SALLY SUE
Age is 33
Here is my note: Sally Sue is 22 on July 7
PI is about 3.142
I have 56 oxen.
I have 1 ox.
feet
About $ 1,234,567.89
The letter (B)
 SSN: 123-45-6789
 SSN: 123-45-6789
 ABC-de-fghi
The age was:  39
Number:        123 and more.
Number: 123        and more.
123 in Octal: 173  Hex: 7b  Binary: 1111011
The party is October (month 10) 16, 2026 06:20:07 - or 06:20:07 AM on a Friday
December 25-Dec-2022
16-Oct-2026 06:20:07 Processing starting
Oct16 06:20 Processing starting
Oct16 06:20 Processing started

==== u1354_more_formatted_strings_28842 | more_formatted_strings | tutorial.txt line 28842 | expected: none
! f$(): the sentence as you would say it, values in place
name$ = 'Sally'
years = 22
print f$('Her name was [[name$]], she was [[years]] old.')
print f$('[[ucase$(name$)]] has [[len(name$)]] letters; next year [[years + 1]]')
print f$('literal [["[["]] here')

total = 1234.5
print f$('Total: [[sprintf$("%.2m", total)]]')

dim scores(3)
fill scores with 90, 85, 77
print f$('scores: [[scores]], best [[stats$max(scores)]]')

line$ = '[[who$]] scored [[points]]'
who$ = 'Ann' \ points = 12
print f$(line$)
who$ = 'Bob' \ points = 15
print f$(line$)

when exception in
  print f$('open [[years')
use
  print 'template error: '; extext$
end when

delay
---- output
Her name was Sally, she was 22 old.
SALLY has 5 letters; next year 23
literal [[ here
Total: 1,234.50
scores: 90  85  77, best 90
Ann scored 12
Bob scored 15
template error: Format is invalid

==== u1355_string_real_29134 | string_real | tutorial.txt line 29134 | expected: none
print val("123.45") + 1000

x$ = '123abc'
print val(x$, 0)
print _integer

print val(x$, 1)

a$ = "There were 10 cats, each had $10,000.56"
cat_count = val(a$, 1)  // extracts the 10
pocket_money = val(a$, 2) // extracts 10000.56

debug show cat_count, pocket_money

a$ = 'We bought 3 tickets.  It was -5 degrees outside, We spent 150.34 Euros. (858) 829-9506.'

print a$
for i = 1 to 6
  num = val(a$, i)
  if _integer = 0 then exit for
  print i, num
next i

print val("123,234.56", 1, 'sep=","')

print val("123,234.56", 1)

a$ = "The invoice showed (5.612,34) Euro credit"
opt$ = 'neg="()",euro=",."'
print val(a$, 1, opt$)

delay
---- output
 1123.45 
 0 
 0 
 123 
CAT_COUNT = 10
POCKET_MONEY = 10000.56
We bought 3 tickets.  It was -5 degrees outside, We spent 150.34 Euros. (858) 829-9506.
 1  3 
 2 -5 
 3  150.34 
 4  858 
 5  829 
 6  9506 
 123 
 123234.56 
-5612.34

==== u1356_json_29904 | json | tutorial.txt line 29904 | expected: none
cluster name: first$, last$   
cluster multi: ssn$, prefix cluster name, tax, is_okay?   
add cluster multi   
  multi->ssn$     = '111-22-3333'   
  multi->name->first$ = 'Mister'    
  multi->name->last$  = 'Smith'   
  multi->tax      = 45.67   
  multi->is_okay? = true         
end add

  add cluster multi   
   multi->ssn$     = '222-33-4444'   
    multi->name->first$ = 'Mister2 "they say"'   
    multi->name->last$  = 'Smith2'   
    multi->tax      =  45.678   
    multi->is_okay? = false        
  end add

  print 'Current row json'   
  x$ =  json$(multi)   
  print change$(x$, chr$(13))  // look pretty for the browser
  print    
     
  print 'Row one json'   
  x$ =  json$(multi, 1)   
  print change$(x$, chr$(13))  // look pretty for the browser
  print  
       
  print 'All rows json'   
  x$ =  json$(multi, -1)   
  print change$(x$, chr$(13))  // look pretty for the browser

    print 'Test jsonUtil$()'
  json_data$ = fileinfo$('@..\safe\safe_data.json', 'contents')
  json_errors = 0

  validate_json with pointer '0/hello', expected 'world'
  validate_json with pointer '0/t', expected 'true'
  validate_json with pointer '0/f', expected 'false'
  validate_json with pointer '0/n', expected 'null'
  validate_json with pointer '0/i', expected '123'
  validate_json with pointer '0/pi', expected '3.1416'
  validate_json with pointer '0/stars', expected '10'
  validate_json with pointer '0/name', expected 'Gabby'
  validate_json with pointer '0/words/1', expected 'new'

  validate_json with pointer '0/1', expected '{OBJECT}'
  validate_json with pointer '0/1/a', expected '789'

  validate_json with pointer '0/a', expected '[ARRAY]'
  validate_json with pointer '0/a/2', expected '3'

  validate_json with pointer '0/address/state', expected 'California'

  validate_json with pointer '1/name', expected 'Sally'
  validate_json with pointer '1/address/state', expected 'Minnesota'
  
  // trailing slashes are ignored
  validate_json with pointer '1/address/state/', expected 'Minnesota'

  delay

  end
  
  routine validate_json with pointer, expected
    result$ = jsonutil$(json_data$, pointer)
    if result$ <> expected then
      print '?? With pointer '; quote$(pointer);'>> Expected '; quote$(expected);', got '; quote$(result$)
      json_errors++
    end if
  end routine
---- output
Current row json
{
   "multi":
      {
      "ssn":"222-33-4444",
      "name": {
         "first":"Mister2 \"they say\"",
         "last":"Smith2"
         },
      "tax":45.678,
      "is_okay":false
      }
}


Row one json
{
   "multi":
      {
      "ssn":"111-22-3333",
      "name": {
         "first":"Mister",
         "last":"Smith"
         },
      "tax":45.67,
      "is_okay":true
      }
}


All rows json
{
   "multi":[
      {
      "ssn":"111-22-3333",
      "name": {
         "first":"Mister",
         "last":"Smith"
         },
      "tax":45.67,
      "is_okay":true
      },
      {
      "ssn":"222-33-4444",
      "name": {
         "first":"Mister2 \"they say\"",
         "last":"Smith2"
         },
      "tax":45.678,
      "is_okay":false
      }
   ]
}

Test jsonUtil$()

==== u1358_rndbytes_30238 | rndbytes | tutorial.txt line 30238 | expected: none
phrase$ = "meet me in the Philippines"
otp_key$ = rndbytes$(len(phrase$))
encrypted$ = xor$(phrase$, otp_key$)
for_emailing$ = base64encode$(encrypted$)

print 'Original: '; phrase$
print 'Base64 Encrypted: '; for_emailing$

// Now  decrypt
encrypted_binary$ = base64decode$(for_emailing$)
decrypted_phrase$ = xor$(encrypted_binary$, otp_key$)
print 'Decrypted: '; decrypted_phrase$

delay
---- output
Original: meet me in the Philippines
Base64 Encrypted: kXZ1n1BHeDWHfGhPmhK8dJbOoTqIxax4E3E=
Decrypted: meet me in the Philippines

==== u1359_date_time_functions_30411 | date_time_functions | tutorial.txt line 30411 | expected: none
print 'date >> '; date
print 'date$>> '; date$

print date$(157049,4)

print days('20291225')
print days('03-Jan-2000',3)

print 'day$>> '; day$
print day$(157049)

print fulltime$(0, 4)

print fulltime$(13321969473, 1)
print fulltime$(13321969473, 2)
print fulltime$(13321969473, 3)
print fulltime$(13321969473, 4)

print seconds('20000122 103050')
print seconds('utc')
print seconds('utcoffset')
print seconds('unix')
print days('2029-12-25')
print seconds('2029-12-25T14:30:00Z')
print sprintf$('%t@yyyy-@mm2-@dd2T@mt:@m2:@s2@tz', 0)
print sprintf$('%t@ts', 0)

print 'time>> '; time
print time(0)
print time(1)
print time(2)
print time(5)

print 'time$>> '; time$
print time$(1800)
print time$(54178)

delay
---- output
date >>  26289 
date$>> 20261016
December 25, 2029
 157049 
 146100 
day$>> Friday
Tuesday
October 16, 2026 06:20:07
02262022 110433
26022022 110433
26-Feb-2022 11:04:33
February 26, 2022 11:04:33
 12624633050 
 13468252807 
-25200 
 1792156807 
 157049 
 13568974200 
2026-10-16T06:20:07-07:00
2026-10-16T06:20:07-07:00
time>>  22807 
 22807 
 0.125 
 0.3697876 
 0.06 
time$>> 06:20:07
00:30
15:02

==== u1360_common_math_functions_30809 | common_math_functions | tutorial.txt line 30809 | expected: none
print abs(-5)

print ceil(1.543)

print clamp(15, 1, 10)
print clamp(5, 1, 10)
print clamp(-3, 1, 10)

print div0(0.8, 0.000004)
print div0(0.8, 0.0)
print div0(6, 3)
print div0(6, 0)

print div0inf(6, 3)
print div0inf(6, 0)
print div0inf(-6, 0)
print div0inf(0, 0)

print fp(238.304)

print int(148.8432)

print integer(4 + (993 * 35))

print ip(1234.56)

print max(5, 9)

print min(5, 9)

print mod(36, 13)

print real(45%)

print remainder(-4,3)

print 'rnd>> '; rnd

print rnd(100);' ';rnd(100); ' '; rnd(100)

print round(21.83492, 2)
print round(21.83492, 4)

print truncate(123.45678, 2)
print truncate(123.45678, 4)

print acos(.75)

print angle(4,9)

print asin(.3)

print atan(33)

print cos(64)

print cosh(31)

print cot(31)

print csc(187)

print deg(14)

print exp(5)

print log(100)

print log2(100)

print log10(100)

print 'pi>> '; pi

print 'eps>> '; eps

print rad(85)

print sec(5)

print sgn(-238)
print sgn(238)
print sgn(0)

print sin(23)

print sinh(23)

print sqrt(64)

print tan(.2)

print tanh(.2)

delay
---- output
 5 
 2 
 10 
 5 
 1 
 200000 
 0 
 2 
 0 
 2 
 Inf 
-Inf 
 NaN 
 0.304 
 148 
 34759 
 1234 
 9 
 5 
 10 
 45 
-1 
rnd>>  0.0669752266258001 
 62   54   87 
 21.83 
 21.8349 
 123.45 
 123.4567 
 0.722734247813416 
 1.15257199721567 
 0.304692654015398 
 1.54050256687612 
 0.39185723042955 
 14524424832623.7 
-2.2640027937820279 
-1.0028370024213374 
 802.1409131831525021 
 148.413159102577 
 4.60517018598809 
 6.64385618977472 
 2 
pi>>  3.1415926535897932 
eps>>  0.0000000000000001 
 1.4835298641951801 
 3.5253200858160917 
-1 
 1 
 0 
-0.846220404175171 
 4872401723.12445 
 8 
 0.202710035508672 
 0.197375320224904

==== u1361_routines_32008 | routines | tutorial.txt line 32008 | expected: none
private routine calculate_tax_due with amount, tax_rate, returning tax_due
  tax_due = amount * tax_rate
end routine

profit = 1234
tax_rate = 6.5/100
calculate_tax_due with amount profit, tax_rate, returning tax_due
print 'Tax due: '; tax_due

! an ARRAY parameter: passed by reference, any size or shape
routine total_of with values(*), returning total
  total = stats$sum(values)
end routine

dim sales(*)
fill sales with 120, 340, 275
total_of with values sales, returning total grand
print 'Grand total: '; grand
print 'As a function:  '; total_of(values = sales)
print 'Piped:          '; sales |> total_of()
---- output
Tax due:  80.21 
Grand total:  735 
As a function:   735 
Piped:           735

==== u1362_pass_clusters_32979 | pass_clusters | tutorial.txt line 32979 | expected: none
// --- Example 1: Calculate Tax ---
cluster taxes: name$, profit, tax_rate
cluster mytaxes using taxes

mytaxes->name$ = 'Sally Sue'
mytaxes->profit = 1234
mytaxes->tax_rate = 6.5/100

calculate_tax_due with taxes mytaxes, returning due tax_due
print 'Tax due:'; tax_due; 'for '; mytaxes->name$

delay

private routine calculate_tax_due with taxes, returning due
  due = taxes->profit * taxes->tax_rate
end routine

// --- Example 2: Meals ---
cluster meal: type$, protein$, liquid$, carb$
cluster breakfast using meal
cluster lunch using meal

breakfast->type$ = "Breakfast"
breakfast->protein$ = "eggs"
breakfast->liquid$ = "tea"
breakfast->carb$ = "toast"

lunch->type$ = "Lunch"
lunch->protein$ = "chicken"
lunch->liquid$ = "coffee"
lunch->carb$ = "rice"

private routine show_one_meal with meal
  print cluster meal
end routine

show_one_meal with meal breakfast
show_one_meal with meal lunch
---- output
Tax due: 80.21 for Sally Sue
"Breakfast","eggs","tea","toast"
"Lunch","chicken","coffee","rice"

==== u1364_modules_33385 | modules | tutorial.txt line 33385 | expected: none
%include '@..\safe\safe_module.spinc'
tax_rate = 6.5/100
cash = 100
taxes.calculate_tax with amount cash, rate tax_rate, returning tax_due total_tax
print 'Total tax is:'; total_tax

delay
---- output
Total tax is: 6.5

==== u1366_include_files_34084 | include_files | tutorial.txt line 34084 | expected: none
%include '@..\safe\safe_common.spinc'
debug show full_name$
do_it

delay
---- output
FULL_NAME$ = "Sally Sue" (9)
Doing the routine called DO_IT

==== u1367_macros_and_blueprints_34767 | macros_and_blueprints | tutorial.txt line 34767 | expected: none
macro maxsize 500
macro maxlen = 600
print 'Size '; @maxsize;', len '; @maxlen

macro myname = "Sally Sue" + chr$(ascii("!"))
print "This is "; @myname

macro age_is = "Your age is [[age=21]] with this project"
print @age_is (age=30)
print @age_is; " for "; @myname

macro log_event_full
print "Line 1:  [[shortname=sysboot]]"
print "line 2:  [[event=an event]] occurred."
end macro

@log_event_full(shortname=Emergency, event="System Boot")
@log_event_full(event="System Boot")
@log_event_full

   macro log_event
    print "[[event_id]] - [[event]] occurred."
    end macro

    print 'Expand a macro'
    @log_event (event_id=sysboot, event="System Boot, etc.")

macro two
  print 'in two'
end macro

macro one
  print 'in one'
  @two
end macro

@one

// Given an expression, show the expression and its result.
macro show_expr = print '[[expr]]: '; [[expr]]

@show_expr (expr=2+sin(45))

macro mycode
  for i=1 to 10_000_000
  next i
end macro

macro time_it
  print 'Timing: [[expr]]'
  start timer
  [[expr]] 
  
  print 'elapsed: '; _elapsed
end macro

@time_it(expr=@mycode)

    blueprint handler
      print "do_read_[[placeholder]]"
      print "do_validate_[[placeholder]]"
      print "do_store_[[placeholder]]"
    end blueprint

    print 'Generate blueprints'
    %generate handler with customer, client, employee

macro simple_message
  print "Hello, world!"
  print "I am fine."
end macro

@simple_message

 macro max_length = 500
 print 'The maximum is: '; @max_length

dim myarray(*)
blueprint load
myarray(*) = [[placeholder]]
end blueprint

print 'Load myarray'
fill myarray with 10,20,30,40,50
%generate load with 100, 200, 300, 400, 500
print 'Display the array'
print myarray

delay
---- output
Size  500 , len  600 
This is Sally Sue!
Your age is 30 with this project
Your age is 21 with this project for Sally Sue!
Line 1:  Emergency
line 2:  System Boot occurred.
Line 1:  sysboot
line 2:  System Boot occurred.
Line 1:  sysboot
line 2:  an event occurred.
Expand a macro
sysboot - System Boot, etc. occurred.
in one
in two
2+sin(45):  2.850903524534118 
Timing: @mycode
elapsed:  0.109 
Generate blueprints
do_read_CUSTOMER
do_validate_CUSTOMER
do_store_CUSTOMER
do_read_CLIENT
do_validate_CLIENT
do_store_CLIENT
do_read_EMPLOYEE
do_validate_EMPLOYEE
do_store_EMPLOYEE
Hello, world!
I am fine.
The maximum is:  500 
Load myarray
Display the array
 10   20   30   40   50  100  200  300  400  500

==== u1368_choose_macros_or_blueprints_35007 | choose_macros_or_blueprints | tutorial.txt line 35007 | expected: none
// Try swapping macro vs blueprint to see the differences.
macro trace = print "TRACE [[msg=ok]]"
@trace (msg="Hello")

blueprint crud
  print "do_read_[[placeholder]]"
  print "do_validate_[[placeholder]]"
  print "do_store_[[placeholder]]"
end blueprint
%generate crud with customer, client

delay
---- output
TRACE Hello
do_read_CUSTOMER
do_validate_CUSTOMER
do_store_CUSTOMER
do_read_CLIENT
do_validate_CLIENT
do_store_CLIENT

==== u1369_conditional_compilation_35335 | conditional_compilation | tutorial.txt line 35335 | expected: none
macro debug_mode xxx
%defined debug_mode
%++ print "Debug mode is defined."
%++ print "More debug mode code"
%-- print "Debug mode was not defined."
%>> print "This code always runs."
%end defined

%defined xxxx
%++ print "Debug mode is defined."
%++ print "More debug mode code"
%-- print "Debug mode was not defined."
%>> print "This code always runs."
%end defined

macro version = 11
macro required_version = 10
%defined version >= required_version
%++ print "Version numeric test ";@required_version; " or more"
%end defined

macro version2 = 11
macro required_version2  '10'
%defined version2 >= required_version2
%++ print "Version String constant test 10 or more"
%-- print "NOT Version String constant test 10 or more"
%end defined

%defined versionx >= '10'
%++ print " String test 10 or more"
%-- print "undefined versionx"
%end defined

macro build_type = "production"

%defined build_type = "production"
%++ print "This is a production build."
%-- print "This is a regular build."
%end defined

%defined _spversion >= 'V011.006'
%++ print "Using features available in Sheerpower V011.006 or later."
%-- print "Update Sheerpower to use these features."
%end defined

%defined _user = 'admin'
%++ print "Admin-specific debugging enabled."
%-- print "Standard user mode. No admin-specific features enabled."
%end defined

delay
---- output
Debug mode is defined.
More debug mode code
This code always runs.
Debug mode was not defined.
This code always runs.
Version numeric test  10  or more
Version String constant test 10 or more
undefined versionx
This is a production build.
Using features available in Sheerpower V011.006 or later.
Standard user mode. No admin-specific features enabled.

==== u1370_unit_testing_36987 | unit_testing | tutorial.txt line 36987 | expected: none
option test on
%test print 'We are in test mode'
age = 15
%test age = 25
debug show age

print 'Turning off test mode'
option test off
%test print 'We are in test mode'
age = 15
%test age = 25
debug show age

%test_ignore age = 100
debug show age

option test on
tax_rate = 6.5/100  // try this without the divide by 100
%test %include '@..\safe\safe_unit_tests.spinc'

delay
---- output
We are in test mode
AGE = 25
Turning off test mode
AGE = 15
AGE = 100
Testing the tax_rate of  0.065 
Tax rate is fine

==== u1371_profiling_37285 | profiling | tutorial.txt line 37285 | expected: none
x = 90
start timer
for i=1 to 1_000_000
  y = sin(x)
next i
print 'Elapsed time: '; _elapsed

delay
---- output
Elapsed time:  0.078

==== u1374_todo_38231 | todo | tutorial.txt line 38231 | expected: none
%todo SSue need more testing later on

delay
---- output
$error |C:\myprograms\u1374_todo_38231.spsrc|1 |1 |%todo SSue need more testing later on

==== u1378_exceptions_42166 | exceptions | tutorial.txt line 42166 | expected: none
a = 45
b = 0

when exception in
  c = a / b
use
  print 'Got an error...'
end when
if _error then
  print ' the error was '; extext$
end if

print

tsales = 100
nsales = 0
when exception use fix_average 
  average = tsales / nsales 
end when
print 'The average is:'; average 

handler fix_average 
  average = 0
  print 'Got error of '; extext$; '  Changing the average to '; average
  continue
end handler

delay
end
---- output
Got an error...
 the error was Division by zero

Got error of Division by zero  Changing the average to  0 
The average is: 0

==== u1380_first_program_43147 | first_program | tutorial.txt line 43147 | expected: none
a$ = 'Sally'
b$ = 'Sue'
x = 10
y = 20
// Click on the "Run" button to try this code.
// You can enter your own Sheerpower code below and run it too! 
// You can also assign values to the variables a$, b$, x, y (above) and use those values in your code.

print 'Hello World'
print

say_hello

tax_rate = 6.5/100
show_tax with rate tax_rate, client a$

delay

routine say_hello
  print 'Hello '; a$; ' '; b$
end routine

routine show_tax with rate, client
  print 'Tax for '; client;' is'; round((x+y)*rate, 2)
end routine
---- output
Hello World

Hello Sally Sue
Tax for Sally is 1.95

==== u1381_VScode_43224 | VScode | tutorial.txt line 43224 | expected: none
a$ = 'Sally'
b$ = 'Sue'
x = 10
y = 20
// Click on the "Run" button to try this code.
// You can enter your own Sheerpower code below and run it too! 
// You can also assign values to the variables a$, b$, x, y (above) and use those values in your code.

print 'Hello World'
print

say_hello

tax_rate = 6.5/100
show_tax with rate tax_rate, client a$

delay

routine say_hello
  print 'Hello '; a$; ' '; b$
end routine

routine show_tax with rate, client
  print 'Tax for '; client;' is'; round((x+y)*rate, 2)
end routine
---- output
Hello World

Hello Sally Sue
Tax for Sally is 1.95

==== u1382_browser_scripting_48368 | browser_scripting | tutorial.txt line 48368 | expected: none
<html>
<head>
</head>
<body>

// Change highvalue  to change the table size
[[
highvalue=val(getsymbol$('highvalue'), false)
if highvalue = 0 then highvalue = 10
highvalue = min(25, highvalue)  // limit to 25x25
]]

<table cellpadding=10>
// lets do the LEFT SIDE first
<tr>
<td>

<h2 class="big"><center>Multiplication Table<br>Written in SCRIPT</center></h2>

<table border=2 cellpadding=5>
  <tr>
  <td>&nbsp;
  [[for j=1 to highvalue]]
    <td bgcolor=yellow align=right>[[j]]
  [[next j]]
  <tr>
  [[for i= 1 to highvalue]]
    <tr>
    <td bgcolor=yellow align=right> [[i]]

    [[for j=1 to highvalue]]
      <td align=right> [[=i*j]]
    [[next j]]
  [[next i]]
</table>

// And, now the right-side -- but this time in a CODE area
[[
print '<td>'

print '<h2 class="big"><center>Multiplication Table<br>Written in CODE</center></h2>'

print '<table border=2 cellpadding=5>'
print '<tr>'
print '<td>&nbsp;'
for j=1 to highvalue
  print '<td bgcolor=yellow align=right>'; j;
next j
print '<tr>'
for i= 1 to highvalue
  print '<tr>'
  print '<td bgcolor=yellow align=right>'; i
  for j=1 to highvalue
    print '<td align=right>'; i*j
  next j
next i
print '</table>'
]]

</table>

</body>
</html>
---- output
<html>
<head>
</head>
<body>


<table cellpadding=10>
<tr>
<td>

<h2 class="big"><center>Multiplication Table<br>Written in SCRIPT</center></h2>

<table border=2 cellpadding=5>
  <tr>
  <td>&nbsp;
      <td bgcolor=yellow align=right> 1       <td bgcolor=yellow align=right> 2       <td bgcolor=yellow align=right> 3       <td bgcolor=yellow align=right> 4       <td bgcolor=yellow align=right> 5       <td bgcolor=yellow align=right> 6       <td bgcolor=yellow align=right> 7       <td bgcolor=yellow align=right> 8       <td bgcolor=yellow align=right> 9       <td bgcolor=yellow align=right> 10     <tr>
      <tr>
    <td bgcolor=yellow align=right>  1 
          <td align=right>  1           <td align=right>  2           <td align=right>  3           <td align=right>  4           <td align=right>  5           <td align=right>  6           <td align=right>  7           <td align=right>  8           <td align=right>  9           <td align=right>  10           <tr>
    <td bgcolor=yellow align=right>  2 
          <td align=right>  2           <td align=right>  4           <td align=right>  6           <td align=right>  8           <td align=right>  10           <td align=right>  12           <td align=right>  14           <td align=right>  16           <td align=right>  18           <td align=right>  20           <tr>
    <td bgcolor=yellow align=right>  3 
          <td align=right>  3           <td align=right>  6           <td align=right>  9           <td align=right>  12           <td align=right>  15           <td align=right>  18           <td align=right>  21           <td align=right>  24           <td align=right>  27           <td align=right>  30           <tr>
    <td bgcolor=yellow align=right>  4 
          <td align=right>  4           <td align=right>  8           <td align=right>  12           <td align=right>  16           <td align=right>  20           <td align=right>  24           <td align=right>  28           <td align=right>  32           <td align=right>  36           <td align=right>  40           <tr>
    <td bgcolor=yellow align=right>  5 
          <td align=right>  5           <td align=right>  10           <td align=right>  15           <td align=right>  20           <td align=right>  25           <td align=right>  30           <td align=right>  35           <td align=right>  40           <td align=right>  45           <td align=right>  50           <tr>
    <td bgcolor=yellow align=right>  6 
          <td align=right>  6           <td align=right>  12           <td align=right>  18           <td align=right>  24           <td align=right>  30           <td align=right>  36           <td align=right>  42           <td align=right>  48           <td align=right>  54           <td align=right>  60           <tr>
    <td bgcolor=yellow align=right>  7 
          <td align=right>  7           <td align=right>  14           <td align=right>  21           <td align=right>  28           <td align=right>  35           <td align=right>  42           <td align=right>  49           <td align=right>  56           <td align=right>  63           <td align=right>  70           <tr>
    <td bgcolor=yellow align=right>  8 
          <td align=right>  8           <td align=right>  16           <td align=right>  24           <td align=right>  32           <td align=right>  40           <td align=right>  48           <td align=right>  56           <td align=right>  64           <td align=right>  72           <td align=right>  80           <tr>
    <td bgcolor=yellow align=right>  9 
          <td align=right>  9           <td align=right>  18           <td align=right>  27           <td align=right>  36           <td align=right>  45           <td align=right>  54           <td align=right>  63           <td align=right>  72           <td align=right>  81           <td align=right>  90           <tr>
    <td bgcolor=yellow align=right>  10 
          <td align=right>  10           <td align=right>  20           <td align=right>  30           <td align=right>  40           <td align=right>  50           <td align=right>  60           <td align=right>  70           <td align=right>  80           <td align=right>  90           <td align=right>  100       </table>

<td>
<h2 class="big"><center>Multiplication Table<br>Written in CODE</center></h2>
<table border=2 cellpadding=5>
<tr>
<td>&nbsp;
<td bgcolor=yellow align=right> 1 <td bgcolor=yellow align=right> 2 <td bgcolor=yellow align=right> 3 <td bgcolor=yellow align=right> 4 <td bgcolor=yellow align=right> 5 <td bgcolor=yellow align=right> 6 <td bgcolor=yellow align=right> 7 <td bgcolor=yellow align=right> 8 <td bgcolor=yellow align=right> 9 <td bgcolor=yellow align=right> 10 <tr>
<tr>
<td bgcolor=yellow align=right> 1 
<td align=right> 1 
<td align=right> 2 
<td align=right> 3 
<td align=right> 4 
<td align=right> 5 
<td align=right> 6 
<td align=right> 7 
<td align=right> 8 
<td align=right> 9 
<td align=right> 10 
<tr>
<td bgcolor=yellow align=right> 2 
<td align=right> 2 
<td align=right> 4 
<td align=right> 6 
<td align=right> 8 
<td align=right> 10 
<td align=right> 12 
<td align=right> 14 
<td align=right> 16 
<td align=right> 18 
<td align=right> 20 
<tr>
<td bgcolor=yellow align=right> 3 
<td align=right> 3 
<td align=right> 6 
<td align=right> 9 
<td align=right> 12 
<td align=right> 15 
<td align=right> 18 
<td align=right> 21 
<td align=right> 24 
<td align=right> 27 
<td align=right> 30 
<tr>
<td bgcolor=yellow align=right> 4 
<td align=right> 4 
<td align=right> 8 
<td align=right> 12 
<td align=right> 16 
<td align=right> 20 
<td align=right> 24 
<td align=right> 28 
<td align=right> 32 
<td align=right> 36 
<td align=right> 40 
<tr>
<td bgcolor=yellow align=right> 5 
<td align=right> 5 
<td align=right> 10 
<td align=right> 15 
<td align=right> 20 
<td align=right> 25 
<td align=right> 30 
<td align=right> 35 
<td align=right> 40 
<td align=right> 45 
<td align=right> 50 
<tr>
<td bgcolor=yellow align=right> 6 
<td align=right> 6 
<td align=right> 12 
<td align=right> 18 
<td align=right> 24 
<td align=right> 30 
<td align=right> 36 
<td align=right> 42 
<td align=right> 48 
<td align=right> 54 
<td align=right> 60 
<tr>
<td bgcolor=yellow align=right> 7 
<td align=right> 7 
<td align=right> 14 
<td align=right> 21 
<td align=right> 28 
<td align=right> 35 
<td align=right> 42 
<td align=right> 49 
<td align=right> 56 
<td align=right> 63 
<td align=right> 70 
<tr>
<td bgcolor=yellow align=right> 8 
<td align=right> 8 
<td align=right> 16 
<td align=right> 24 
<td align=right> 32 
<td align=right> 40 
<td align=right> 48 
<td align=right> 56 
<td align=right> 64 
<td align=right> 72 
<td align=right> 80 
<tr>
<td bgcolor=yellow align=right> 9 
<td align=right> 9 
<td align=right> 18 
<td align=right> 27 
<td align=right> 36 
<td align=right> 45 
<td align=right> 54 
<td align=right> 63 
<td align=right> 72 
<td align=right> 81 
<td align=right> 90 
<tr>
<td bgcolor=yellow align=right> 10 
<td align=right> 10 
<td align=right> 20 
<td align=right> 30 
<td align=right> 40 
<td align=right> 50 
<td align=right> 60 
<td align=right> 70 
<td align=right> 80 
<td align=right> 90 
<td align=right> 100 
</table>

</table>

</body>
</html>

==== u1383_appendix_code_comment_header_51258 | appendix_code-comment_headers | tutorial.txt line 51258 | expected: none
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! Program: sample
! System : Tutorials
! Author : Mister Dan
! Company: Touch Technologies, Inc.
! Date   : August 24, 2024
! Purpose: Show the standard format for Sheerpower Programs
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!         I n i t i a l i z a t i o n
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// initialize variables, declare clusters, etc

!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!         M a i n   L o g i c   A r e a
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

delay

stop

!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!         R o u t i n e s
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! a d d _ i t _ u p 
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!
! Brief description:
!    Add two numbers and show the resul
!
! Expected on entry:
!    p1
!    p2
!
! Locals used:
!    
!
! Results on exit:
!    total = the total of p1 and p2
!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
routine add_it_up with p1, p2, returning total
  // your code here
end routine

end
---- output


==== u1384_the_end_51364 | the_end | tutorial.txt line 51364 | expected: none
a$ = 'Duluth'
x = 100
y = 200
answer = 1.2 - 1.0
debug show answer

full_name$ = 'Tom Smith'
print full_name$

income = 3456.99
print income + x + y
print

bible$ = fileinfo$('@..\safe\safe_bible.txt', 'contents')
for idx = 1007 to 1019
  print getword$(bible$, idx); ' ';
next idx
print

commas$ = "###,###,###"
cluster cities: City$, Country$, Population, Region$, Latitude, Longitude
cluster input name '@..\safe\safe_world_cities.csv', headers 1: cities

mycity$ = a$ 
do
  row = findrow(cities->city$, mycity$)
  if row = 0 then
    print 'Unknown city: ['; mycity$;'] Try a different value for a$ -- like Duluth'
    exit do
  end if
  print full_name$; ' lives in '; mycity$; ', population '; trim$(format$(cities->population, commas$))
end do

delay
---- output
ANSWER = 0.2
Tom Smith
 3756.99 

for the LORD God had not yet sent rain upon the earth and 
Tom Smith lives in Duluth, population 84,800

==== u1385_Guessing_Game_51512 | Guessing Game | tutorial.txt line 51512 | expected: none
x = 0
print 'A simple guessing game'
print

highnum = 5
target = rnd(highnum)

print 'Shhh.. the target was:'; target
print

// Uncomment below if you downloaded Sheerpower
// input 'Your guess': x 

if x = 0 then
  print "Put into X your guess and click on RUN"
  stop
end if

if x > target then
  print "too high"
elseif x < target then
  print "too low"
else
  print "You got it"
end if

delay
---- output
A simple guessing game

Shhh.. the target was: 1 

Put into X your guess and click on RUN

==== u1387_sieve_51930 | sieve | tutorial.txt line 51930 | expected: none
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! Program: PrimeNumbers.spsrc
! System : Prime Number Calculation
! Author : ChatGPT
! Date   : June 21, 2024
! Purpose: Calculate and display prime numbers up to a given upper bound.
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

! Initialization
const upper_bound = 100_000

print 'This program returns the prime numbers'
print 'less or equal than an upper bound determined by you.'

start timer

! Perform Sieve of Eratosthenes
do_sieve

print 'Number of primes from zero to'; upper_bound; ': '; sieve; 'primes found.'
print 'Elapsed time in seconds: '; _elapsed

! Display prime numbers
display_primes

delay

stop

!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
!         R o u t i n e s
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! Routine: do_sieve
! Purpose: Perform the Sieve of Eratosthenes to find prime numbers.
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
routine do_sieve
  dim flags?(1 to upper_bound)
  ! Initialize array to assume all numbers are prime
  for i = 2 to upper_bound
    flags?(i) = true
  next i
  
  ! Sieve process
  up_to_here = sqrt(upper_bound)
  for i = 2 to up_to_here
    if flags?(i) = false then iterate for
    for j = i to (upper_bound / i)
      flags?(i * j) = false
    next j
    sieve = sieve + 1
  next i
  
  ! Count remaining primes
  for i = up_to_here + 1 to upper_bound
    if flags?(i) = true then sieve = sieve + 1
  next i
end routine

!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! Routine: display_primes
! Purpose: Display the prime numbers found by the sieve.
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
routine display_primes
  for i = 1 to upper_bound
    if flags?(i) = true then print i,
  next i
  print
end routine

end
---- output
This program returns the prime numbers
less or equal than an upper bound determined by you.
Number of primes from zero to 100000 :  9592 primes found.
Elapsed time in seconds:  0.031 
 2  3  5  7  11  13  17  19  23  29  31  37  41  43  47  53  59  61  67  71  73  79  83  89  97  101  103  107  109  113  127  131  137  139  149  151  157  163  167  173  179  181  191  193  197  199  211  223  227  229  233  239  241  251  257  263  269  271  277  281  283  293  307  311  313  317  331  337  347  349  353  359  367  373  379  383  389  397  401  409  419  421  431  433  439  443  449  457  461  463  467  479  487  491  499  503  509  521  523  541  547  557  563  569  571  577  587  593  599  601  607  613  617  619  631  641  643  647  653  659  661  673  677  683  691  701  709  719  727  733  739  743  751  757  761  769  773  787  797  809  811  821  823  827  829  839  853  857  859  863  877  881  883  887  907  911  919  929  937  941  947  953  967  971  977  983  991  997  1009  1013  1019  1021  1031  1033  1039  1049  1051  1061  1063  1069  1087  1091  1093  1097  1103  1109  1117  1123  1129  1151  1153  1163  1171  1181  1187  1193  1201  1213  1217  1223  1229  1231  1237  1249  1259  1277  1279  1283  1289  1291  1297  1301  1303  1307  1319  1321  1327  1361  1367  1373  1381  1399  1409  1423  1427  1429  1433  1439  1447  1451  1453  1459  1471  1481  1483  1487  1489  1493  1499  1511  1523  1531  1543  1549  1553  1559  1567  1571  1579  1583  1597  1601  1607  1609  1613  1619  1621  1627  1637  1657  1663  1667  1669  1693  1697  1699  1709  1721  1723  1733  1741  1747  1753  1759  1777  1783  1787  1789  1801  1811  1823  1831  1847  1861  1867  1871  1873  1877  1879  1889  1901  1907  1913  1931  1933  1949  1951  1973  1979  1987  1993  1997  1999  2003  2011  2017  2027  2029  2039  2053  2063  2069  2081  2083  2087  2089  2099  2111  2113  2129  2131  2137  2141  2143  2153  2161  2179  2203  2207  2213  2221  2237  2239  2243  2251  2267  2269  2273  2281  2287  2293  2297  2309  2311  2333  2339  2341  2347  2351  2357  2371  2377  2381  2383  2389  2393  2399  2411  2417  2423  2437  2441  2447  2459  2467  2473  2477  2503  2521  2531  2539  2543  2549  2551  2557  2579  2591  2593  2609  2617  2621  2633  2647  2657  2659  2663  2671  2677  2683  2687  2689  2693  2699  2707  2711  2713  2719  2729  2731  2741  2749  2753  2767  2777  2789  2791  2797  2801  2803  2819  2833  2837  2843  2851  2857  2861  2879  2887  2897  2903  2909  2917  2927  2939  2953  2957  2963  2969  2971  2999  3001  3011  3019  3023  3037  3041  3049  3061  3067  3079  3083  3089  3109  3119  3121  3137  3163  3167  3169  3181  3187  3191  3203  3209  3217  3221  3229  3251  3253  3257  3259  3271  3299  3301  3307  3313  3319  3323  3329  3331  3343  3347  3359  3361  3371  3373  3389  3391  3407  3413  3433  3449  3457  3461  3463  3467  3469  3491  3499  3511  3517  3527  3529  3533  3539  3541  3547  3557  3559  3571  3581  3583  3593  3607  3613  3617  3623  3631  3637  3643  3659  3671  3673  3677  3691  3697  3701  3709  3719  3727  3733  3739  3761  3767  3769  3779  3793  3797  3803  3821  3823  3833  3847  3851  3853  3863  3877  3881  3889  3907  3911  3917  3919  3923  3929  3931  3943  3947  3967  3989  4001  4003  4007  4013  4019  4021  4027  4049  4051  4057  4073  4079  4091  4093  4099  4111  4127  4129  4133  4139  4153  4157  4159  4177  4201  4211  4217  4219  4229  4231  4241  4243  4253  4259  4261  4271  4273  4283  4289  4297  4327  4337  4339  4349  4357  4363  4373  4391  4397  4409  4421  4423  4441  4447  4451  4457  4463  4481  4483  4493  4507  4513  4517  4519  4523  4547  4549  4561  4567  4583  4591  4597  4603  4621  4637  4639  4643  4649  4651  4657  4663  4673  4679  4691  4703  4721  4723  4729  4733  4751  4759  4783  4787  4789  4793  4799  4801  4813  4817  4831  4861  4871  4877  4889  4903  4909  4919  4931  4933  4937  4943  4951  4957  4967  4969  4973  4987  4993  4999  5003  5009  5011  5021  5023  5039  5051  5059  5077  5081  5087  5099  5101  5107  5113  5119  5147  5153  5167  5171  5179  5189  5197  5209  5227  5231  5233  5237  5261  5273  5279  5281  5297  5303  5309  5323  5333  5347  5351  5381  5387  5393  5399  5407  5413  5417  5419  5431  5437  5441  5443  5449  5471  5477  5479  5483  5501  5503  5507  5519  5521  5527  5531  5557  5563  5569  5573  5581  5591  5623  5639  5641  5647  5651  5653  5657  5659  5669  5683  5689  5693  5701  5711  5717  5737  5741  5743  5749  5779  5783  5791  5801  5807  5813  5821  5827  5839  5843  5849  5851  5857  5861  5867  5869  5879  5881  5897  5903  5923  5927  5939  5953  5981  5987  6007  6011  6029  6037  6043  6047  6053  6067  6073  6079  6089  6091  6101  6113  6121  6131  6133  6143  6151  6163  6173  6197  6199  6203  6211  6217  6221  6229  6247  6257  6263  6269  6271  6277  6287  6299  6301  6311  6317  6323  6329  6337  6343  6353  6359  6361  6367  6373  6379  6389  6397  6421  6427  6449  6451  6469  6473  6481  6491  6521  6529  6547  6551  6553  6563  6569  6571  6577  6581  6599  6607  6619  6637  6653  6659  6661  6673  6679  6689  6691  6701  6703  6709  6719  6733  6737  6761  6763  6779  6781  6791  6793  6803  6823  6827  6829  6833  6841  6857  6863  6869  6871  6883  6899  6907  6911  6917  6947  6949  6959  6961  6967  6971  6977  6983  6991  6997  7001  7013  7019  7027  7039  7043  7057  7069  7079  7103  7109  7121  7127  7129  7151  7159  7177  7187  7193  7207  7211  7213  7219  7229  7237  7243  7247  7253  7283  7297  7307  7309  7321  7331  7333  7349  7351  7369  7393  7411  7417  7433  7451  7457  7459  7477  7481  7487  7489  7499  7507  7517  7523  7529  7537  7541  7547  7549  7559  7561  7573  7577  7583  7589  7591  7603  7607  7621  7639  7643  7649  7669  7673  7681  7687  7691  7699  7703  7717  7723  7727  7741  7753  7757  7759  7789  7793  7817  7823  7829  7841  7853  7867  7873  7877  7879  7883  7901  7907  7919  7927  7933  7937  7949  7951  7963  7993  8009  8011  8017  8039  8053  8059  8069  8081  8087  8089  8093  8101  8111  8117  8123  8147  8161  8167  8171  8179  8191  8209  8219  8221  8231  8233  8237  8243  8263  8269  8273  8287  8291  8293  8297  8311  8317  8329  8353  8363  8369  8377  8387  8389  8419  8423  8429  8431  8443  8447  8461  8467  8501  8513  8521  8527  8537  8539  8543  8563  8573  8581  8597  8599  8609  8623  8627  8629  8641  8647  8663  8669  8677  8681  8689  8693  8699  8707  8713  8719  8731  8737  8741  8747  8753  8761  8779  8783  8803  8807  8819  8821  8831  8837  8839  8849  8861  8863  8867  8887  8893  8923  8929  8933  8941  8951  8963  8969  8971  8999  9001  9007  9011  9013  9029  9041  9043  9049  9059  9067  9091  9103  9109  9127  9133  9137  9151  9157  9161  9173  9181  9187  9199  9203  9209  9221  9227  9239  9241  9257  9277  9281  9283  9293  9311  9319  9323  9337  9341  9343  9349  9371  9377  9391  9397  9403  9413  9419  9421  9431  9433  9437  9439  9461  9463  9467  9473  9479  9491  9497  9511  9521  9533  9539  9547  9551  9587  9601  9613  9619  9623  9629  9631  9643  9649  9661  9677  9679  9689  9697  9719  9721  9733  9739  9743  9749  9767  9769  9781  9787  9791  9803  9811  9817  9829  9833  9839  9851  9857  9859  9871  9883  9887  9901  9907  9923  9929  9931  9941  9949  9967  9973  10007  10009  10037  10039  10061  10067  10069  10079  10091  10093  10099  10103  10111  10133  10139  10141  10151  10159  10163  10169  10177  10181  10193  10211  10223  10243  10247  10253  10259  10267  10271  10273  10289  10301  10303  10313  10321  10331  10333  10337  10343  10357  10369  10391  10399  10427  10429  10433  10453  10457  10459  10463  10477  10487  10499  10501  10513  10529  10531  10559  10567  10589  10597  10601  10607  10613  10627  10631  10639  10651  10657  10663  10667  10687  10691  10709  10711  10723  10729  10733  10739  10753  10771  10781  10789  10799  10831  10837  10847  10853  10859  10861  10867  10883  10889  10891  10903  10909  10937  10939  10949  10957  10973  10979  10987  10993  11003  11027  11047  11057  11059  11069  11071  11083  11087  11093  11113  11117  11119  11131  11149  11159  11161  11171  11173  11177  11197  11213  11239  11243  11251  11257  11261  11273  11279  11287  11299  11311  11317  11321  11329  11351  11353  11369  11383  11393  11399  11411  11423  11437  11443  11447  11467  11471  11483  11489  11491  11497  11503  11519  11527  11549  11551  11579  11587  11593  11597  11617  11621  11633  11657  11677  11681  11689  11699  11701  11717  11719  11731  11743  11777  11779  11783  11789  11801  11807  11813  11821  11827  11831  11833  11839  11863  11867  11887  11897  11903  11909  11923  11927  11933  11939  11941  11953  11959  11969  11971  11981  11987  12007  12011  12037  12041  12043  12049  12071  12073  12097  12101  12107  12109  12113  12119  12143  12149  12157  12161  12163  12197  12203  12211  12227  12239  12241  12251  12253  12263  12269  12277  12281  12289  12301  12323  12329  12343  12347  12373  12377  12379  12391  12401  12409  12413  12421  12433  12437  12451  12457  12473  12479  12487  12491  12497  12503  12511  12517  12527  12539  12541  12547  12553  12569  12577  12583  12589  12601  12611  12613  12619  12637  12641  12647  12653  12659  12671  12689  12697  12703  12713  12721  12739  12743  12757  12763  12781  12791  12799  12809  12821  12823  12829  12841  12853  12889  12893  12899  12907  12911  12917  12919  12923  12941  12953  12959  12967  12973  12979  12983  13001  13003  13007  13009  13033  13037  13043  13049  13063  13093  13099  13103  13109  13121  13127  13147  13151  13159  13163  13171  13177  13183  13187  13217  13219  13229  13241  13249  13259  13267  13291  13297  13309  13313  13327  13331  13337  13339  13367  13381  13397  13399  13411  13417  13421  13441  13451  13457  13463  13469  13477  13487  13499  13513  13523  13537  13553  13567  13577  13591  13597  13613  13619  13627  13633  13649  13669  13679  13681  13687  13691  13693  13697  13709  13711  13721  13723  13729  13751  13757  13759  13763  13781  13789  13799  13807  13829  13831  13841  13859  13873  13877  13879  13883  13901  13903  13907  13913  13921  13931  13933  13963  13967  13997  13999  14009  14011  14029  14033  14051  14057  14071  14081  14083  14087  14107  14143  14149  14153  14159  14173  14177  14197  14207  14221  14243  14249  14251  14281  14293  14303  14321  14323  14327  14341  14347  14369  14387  14389  14401  14407  14411  14419  14423  14431  14437  14447  14449  14461  14479  14489  14503  14519  14533  14537  14543  14549  14551  14557  14561  14563  14591  14593  14621  14627  14629  14633  14639  14653  14657  14669  14683  14699  14713  14717  14723  14731  14737  14741  14747  14753  14759  14767  14771  14779  14783  14797  14813  14821  14827  14831  14843  14851  14867  14869  14879  14887  14891  14897  14923  14929  14939  14947  14951  14957  14969  14983  15013  15017  15031  15053  15061  15073  15077  15083  15091  15101  15107  15121  15131  15137  15139  15149  15161  15173  15187  15193  15199  15217  15227  15233  15241  15259  15263  15269  15271  15277  15287  15289  15299  15307  15313  15319  15329  15331  15349  15359  15361  15373  15377  15383  15391  15401  15413  15427  15439  15443  15451  15461  15467  15473  15493  15497  15511  15527  15541  15551  15559  15569  15581  15583  15601  15607  15619  15629  15641  15643  15647  15649  15661  15667  15671  15679  15683  15727  15731  15733  15737  15739  15749  15761  15767  15773  15787  15791  15797  15803  15809  15817  15823  15859  15877  15881  15887  15889  15901  15907  15913  15919  15923  15937  15959  15971  15973  15991  16001  16007  16033  16057  16061  16063  16067  16069  16073  16087  16091  16097  16103  16111  16127  16139  16141  16183  16187  16189  16193  16217  16223  16229  16231  16249  16253  16267  16273  16301  16319  16333  16339  16349  16361  16363  16369  16381  16411  16417  16421  16427  16433  16447  16451  16453  16477  16481  16487  16493  16519  16529  16547  16553  16561  16567  16573  16603  16607  16619  16631  16633  16649  16651  16657  16661  16673  16691  16693  16699  16703  16729  16741  16747  16759  16763  16787  16811  16823  16829  16831  16843  16871  16879  16883  16889  16901  16903  16921  16927  16931  16937  16943  16963  16979  16981  16987  16993  17011  17021  17027  17029  17033  17041  17047  17053  17077  17093  17099  17107  17117  17123  17137  17159  17167  17183  17189  17191  17203  17207  17209  17231  17239  17257  17291  17293  17299  17317  17321  17327  17333  17341  17351  17359  17377  17383  17387  17389  17393  17401  17417  17419  17431  17443  17449  17467  17471  17477  17483  17489  17491  17497  17509  17519  17539  17551  17569  17573  17579  17581  17597  17599  17609  17623  17627  17657  17659  17669  17681  17683  17707  17713  17729  17737  17747  17749  17761  17783  17789  17791  17807  17827  17837  17839  17851  17863  17881  17891  17903  17909  17911  17921  17923  17929  17939  17957  17959  17971  17977  17981  17987  17989  18013  18041  18043  18047  18049  18059  18061  18077  18089  18097  18119  18121  18127  18131  18133  18143  18149  18169  18181  18191  18199  18211  18217  18223  18229  18233  18251  18253  18257  18269  18287  18289  18301  18307  18311  18313  18329  18341  18353  18367  18371  18379  18397  18401  18413  18427  18433  18439  18443  18451  18457  18461  18481  18493  18503  18517  18521  18523  18539  18541  18553  18583  18587  18593  18617  18637  18661  18671  18679  18691  18701  18713  18719  18731  18743  18749  18757  18773  18787  18793  18797  18803  18839  18859  18869  18899  18911  18913  18917  18919  18947  18959  18973  18979  19001  19009  19013  19031  19037  19051  19069  19073  19079  19081  19087  19121  19139  19141  19157  19163  19181  19183  19207  19211  19213  19219  19231  19237  19249  19259  19267  19273  19289  19301  19309  19319  19333  19373  19379  19381  19387  19391  19403  19417  19421  19423  19427  19429  19433  19441  19447  19457  19463  19469  19471  19477  19483  19489  19501  19507  19531  19541  19543  19553  19559  19571  19577  19583  19597  19603  19609  19661  19681  19687  19697  19699  19709  19717  19727  19739  19751  19753  19759  19763  19777  19793  19801  19813  19819  19841  19843  19853  19861  19867  19889  19891  19913  19919  19927  19937  19949  19961  19963  19973  19979  19991  19993  19997  20011  20021  20023  20029  20047  20051  20063  20071  20089  20101  20107  20113  20117  20123  20129  20143  20147  20149  20161  20173  20177  20183  20201  20219  20231  20233  20249  20261  20269  20287  20297  20323  20327  20333  20341  20347  20353  20357  20359  20369  20389  20393  20399  20407  20411  20431  20441  20443  20477  20479  20483  20507  20509  20521  20533  20543  20549  20551  20563  20593  20599  20611  20627  20639  20641  20663  20681  20693  20707  20717  20719  20731  20743  20747  20749  20753  20759  20771  20773  20789  20807  20809  20849  20857  20873  20879  20887  20897  20899  20903  20921  20929  20939  20947  20959  20963  20981  20983  21001  21011  21013  21017  21019  21023  21031  21059  21061  21067  21089  21101  21107  21121  21139  21143  21149  21157  21163  21169  21179  21187  21191  21193  21211  21221  21227  21247  21269  21277  21283  21313  21317  21319  21323  21341  21347  21377  21379  21383  21391  21397  21401  21407  21419  21433  21467  21481  21487  21491  21493  21499  21503  21517  21521  21523  21529  21557  21559  21563  21569  21577  21587  21589  21599  21601  21611  21613  21617  21647  21649  21661  21673  21683  21701  21713  21727  21737  21739  21751  21757  21767  21773  21787  21799  21803  21817  21821  21839  21841  21851  21859  21863  21871  21881  21893  21911  21929  21937  21943  21961  21977  21991  21997  22003  22013  22027  22031  22037  22039  22051  22063  22067  22073  22079  22091  22093  22109  22111  22123  22129  22133  22147  22153  22157  22159  22171  22189  22193  22229  22247  22259  22271  22273  22277  22279  22283  22291  22303  22307  22343  22349  22367  22369  22381  22391  22397  22409  22433  22441  22447  22453  22469  22481  22483  22501  22511  22531  22541  22543  22549  22567  22571  22573  22613  22619  22621  22637  22639  22643  22651  22669  22679  22691  22697  22699  22709  22717  22721  22727  22739  22741  22751  22769  22777  22783  22787  22807  22811  22817  22853  22859  22861  22871  22877  22901  22907  22921  22937  22943  22961  22963  22973  22993  23003  23011  23017  23021  23027  23029  23039  23041  23053  23057  23059  23063  23071  23081  23087  23099  23117  23131  23143  23159  23167  23173  23189  23197  23201  23203  23209  23227  23251  23269  23279  23291  23293  23297  23311  23321  23327  23333  23339  23357  23369  23371  23399  23417  23431  23447  23459  23473  23497  23509  23531  23537  23539  23549  23557  23561  23563  23567  23581  23593  23599  23603  23609  23623  23627  23629  23633  23663  23669  23671  23677  23687  23689  23719  23741  23743  23747  23753  23761  23767  23773  23789  23801  23813  23819  23827  23831  23833  23857  23869  23873  23879  23887  23893  23899  23909  23911  23917  23929  23957  23971  23977  23981  23993  24001  24007  24019  24023  24029  24043  24049  24061  24071  24077  24083  24091  24097  24103  24107  24109  24113  24121  24133  24137  24151  24169  24179  24181  24197  24203  24223  24229  24239  24247  24251  24281  24317  24329  24337  24359  24371  24373  24379  24391  24407  24413  24419  24421  24439  24443  24469  24473  24481  24499  24509  24517  24527  24533  24547  24551  24571  24593  24611  24623  24631  24659  24671  24677  24683  24691  24697  24709  24733  24749  24763  24767  24781  24793  24799  24809  24821  24841  24847  24851  24859  24877  24889  24907  24917  24919  24923  24943  24953  24967  24971  24977  24979  24989  25013  25031  25033  25037  25057  25073  25087  25097  25111  25117  25121  25127  25147  25153  25163  25169  25171  25183  25189  25219  25229  25237  25243  25247  25253  25261  25301  25303  25307  25309  25321  25339  25343  25349  25357  25367  25373  25391  25409  25411  25423  25439  25447  25453  25457  25463  25469  25471  25523  25537  25541  25561  25577  25579  25583  25589  25601  25603  25609  25621  25633  25639  25643  25657  25667  25673  25679  25693  25703  25717  25733  25741  25747  25759  25763  25771  25793  25799  25801  25819  25841  25847  25849  25867  25873  25889  25903  25913  25919  25931  25933  25939  25943  25951  25969  25981  25997  25999  26003  26017  26021  26029  26041  26053  26083  26099  26107  26111  26113  26119  26141  26153  26161  26171  26177  26183  26189  26203  26209  26227  26237  26249  26251  26261  26263  26267  26293  26297  26309  26317  26321  26339  26347  26357  26371  26387  26393  26399  26407  26417  26423  26431  26437  26449  26459  26479  26489  26497  26501  26513  26539  26557  26561  26573  26591  26597  26627  26633  26641  26647  26669  26681  26683  26687  26693  26699  26701  26711  26713  26717  26723  26729  26731  26737  26759  26777  26783  26801  26813  26821  26833  26839  26849  26861  26863  26879  26881  26891  26893  26903  26921  26927  26947  26951  26953  26959  26981  26987  26993  27011  27017  27031  27043  27059  27061  27067  27073  27077  27091  27103  27107  27109  27127  27143  27179  27191  27197  27211  27239  27241  27253  27259  27271  27277  27281  27283  27299  27329  27337  27361  27367  27397  27407  27409  27427  27431  27437  27449  27457  27479  27481  27487  27509  27527  27529  27539  27541  27551  27581  27583  27611  27617  27631  27647  27653  27673  27689  27691  27697  27701  27733  27737  27739  27743  27749  27751  27763  27767  27773  27779  27791  27793  27799  27803  27809  27817  27823  27827  27847  27851  27883  27893  27901  27917  27919  27941  27943  27947  27953  27961  27967  27983  27997  28001  28019  28027  28031  28051  28057  28069  28081  28087  28097  28099  28109  28111  28123  28151  28163  28181  28183  28201  28211  28219  28229  28277  28279  28283  28289  28297  28307  28309  28319  28349  28351  28387  28393  28403  28409  28411  28429  28433  28439  28447  28463  28477  28493  28499  28513  28517  28537  28541  28547  28549  28559  28571  28573  28579  28591  28597  28603  28607  28619  28621  28627  28631  28643  28649  28657  28661  28663  28669  28687  28697  28703  28711  28723  28729  28751  28753  28759  28771  28789  28793  28807  28813  28817  28837  28843  28859  28867  28871  28879  28901  28909  28921  28927  28933  28949  28961  28979  29009  29017  29021  29023  29027  29033  29059  29063  29077  29101  29123  29129  29131  29137  29147  29153  29167  29173  29179  29191  29201  29207  29209  29221  29231  29243  29251  29269  29287  29297  29303  29311  29327  29333  29339  29347  29363  29383  29387  29389  29399  29401  29411  29423  29429  29437  29443  29453  29473  29483  29501  29527  29531  29537  29567  29569  29573  29581  29587  29599  29611  29629  29633  29641  29663  29669  29671  29683  29717  29723  29741  29753  29759  29761  29789  29803  29819  29833  29837  29851  29863  29867  29873  29879  29881  29917  29921  29927  29947  29959  29983  29989  30011  30013  30029  30047  30059  30071  30089  30091  30097  30103  30109  30113  30119  30133  30137  30139  30161  30169  30181  30187  30197  30203  30211  30223  30241  30253  30259  30269  30271  30293  30307  30313  30319  30323  30341  30347  30367  30389  30391  30403  30427  30431  30449  30467  30469  30491  30493  30497  30509  30517  30529  30539  30553  30557  30559  30577  30593  30631  30637  30643  30649  30661  30671  30677  30689  30697  30703  30707  30713  30727  30757  30763  30773  30781  30803  30809  30817  30829  30839  30841  30851  30853  30859  30869  30871  30881  30893  30911  30931  30937  30941  30949  30971  30977  30983  31013  31019  31033  31039  31051  31063  31069  31079  31081  31091  31121  31123  31139  31147  31151  31153  31159  31177  31181  31183  31189  31193  31219  31223  31231  31237  31247  31249  31253  31259  31267  31271  31277  31307  31319  31321  31327  31333  31337  31357  31379  31387  31391  31393  31397  31469  31477  31481  31489  31511  31513  31517  31531  31541  31543  31547  31567  31573  31583  31601  31607  31627  31643  31649  31657  31663  31667  31687  31699  31721  31723  31727  31729  31741  31751  31769  31771  31793  31799  31817  31847  31849  31859  31873  31883  31891  31907  31957  31963  31973  31981  31991  32003  32009  32027  32029  32051  32057  32059  32063  32069  32077  32083  32089  32099  32117  32119  32141  32143  32159  32173  32183  32189  32191  32203  32213  32233  32237  32251  32257  32261  32297  32299  32303  32309  32321  32323  32327  32341  32353  32359  32363  32369  32371  32377  32381  32401  32411  32413  32423  32429  32441  32443  32467  32479  32491  32497  32503  32507  32531  32533  32537  32561  32563  32569  32573  32579  32587  32603  32609  32611  32621  32633  32647  32653  32687  32693  32707  32713  32717  32719  32749  32771  32779  32783  32789  32797  32801  32803  32831  32833  32839  32843  32869  32887  32909  32911  32917  32933  32939  32941  32957  32969  32971  32983  32987  32993  32999  33013  33023  33029  33037  33049  33053  33071  33073  33083  33091  33107  33113  33119  33149  33151  33161  33179  33181  33191  33199  33203  33211  33223  33247  33287  33289  33301  33311  33317  33329  33331  33343  33347  33349  33353  33359  33377  33391  33403  33409  33413  33427  33457  33461  33469  33479  33487  33493  33503  33521  33529  33533  33547  33563  33569  33577  33581  33587  33589  33599  33601  33613  33617  33619  33623  33629  33637  33641  33647  33679  33703  33713  33721  33739  33749  33751  33757  33767  33769  33773  33791  33797  33809  33811  33827  33829  33851  33857  33863  33871  33889  33893  33911  33923  33931  33937  33941  33961  33967  33997  34019  34031  34033  34039  34057  34061  34123  34127  34129  34141  34147  34157  34159  34171  34183  34211  34213  34217  34231  34253  34259  34261  34267  34273  34283  34297  34301  34303  34313  34319  34327  34337  34351  34361  34367  34369  34381  34403  34421  34429  34439  34457  34469  34471  34483  34487  34499  34501  34511  34513  34519  34537  34543  34549  34583  34589  34591  34603  34607  34613  34631  34649  34651  34667  34673  34679  34687  34693  34703  34721  34729  34739  34747  34757  34759  34763  34781  34807  34819  34841  34843  34847  34849  34871  34877  34883  34897  34913  34919  34939  34949  34961  34963  34981  35023  35027  35051  35053  35059  35069  35081  35083  35089  35099  35107  35111  35117  35129  35141  35149  35153  35159  35171  35201  35221  35227  35251  35257  35267  35279  35281  35291  35311  35317  35323  35327  35339  35353  35363  35381  35393  35401  35407  35419  35423  35437  35447  35449  35461  35491  35507  35509  35521  35527  35531  35533  35537  35543  35569  35573  35591  35593  35597  35603  35617  35671  35677  35729  35731  35747  35753  35759  35771  35797  35801  35803  35809  35831  35837  35839  35851  35863  35869  35879  35897  35899  35911  35923  35933  35951  35963  35969  35977  35983  35993  35999  36007  36011  36013  36017  36037  36061  36067  36073  36083  36097  36107  36109  36131  36137  36151  36161  36187  36191  36209  36217  36229  36241  36251  36263  36269  36277  36293  36299  36307  36313  36319  36341  36343  36353  36373  36383  36389  36433  36451  36457  36467  36469  36473  36479  36493  36497  36523  36527  36529  36541  36551  36559  36563  36571  36583  36587  36599  36607  36629  36637  36643  36653  36671  36677  36683  36691  36697  36709  36713  36721  36739  36749  36761  36767  36779  36781  36787  36791  36793  36809  36821  36833  36847  36857  36871  36877  36887  36899  36901  36913  36919  36923  36929  36931  36943  36947  36973  36979  36997  37003  37013  37019  37021  37039  37049  37057  37061  37087  37097  37117  37123  37139  37159  37171  37181  37189  37199  37201  37217  37223  37243  37253  37273  37277  37307  37309  37313  37321  37337  37339  37357  37361  37363  37369  37379  37397  37409  37423  37441  37447  37463  37483  37489  37493  37501  37507  37511  37517  37529  37537  37547  37549  37561  37567  37571  37573  37579  37589  37591  37607  37619  37633  37643  37649  37657  37663  37691  37693  37699  37717  37747  37781  37783  37799  37811  37813  37831  37847  37853  37861  37871  37879  37889  37897  37907  37951  37957  37963  37967  37987  37991  37993  37997  38011  38039  38047  38053  38069  38083  38113  38119  38149  38153  38167  38177  38183  38189  38197  38201  38219  38231  38237  38239  38261  38273  38281  38287  38299  38303  38317  38321  38327  38329  38333  38351  38371  38377  38393  38431  38447  38449  38453  38459  38461  38501  38543  38557  38561  38567  38569  38593  38603  38609  38611  38629  38639  38651  38653  38669  38671  38677  38693  38699  38707  38711  38713  38723  38729  38737  38747  38749  38767  38783  38791  38803  38821  38833  38839  38851  38861  38867  38873  38891  38903  38917  38921  38923  38933  38953  38959  38971  38977  38993  39019  39023  39041  39043  39047  39079  39089  39097  39103  39107  39113  39119  39133  39139  39157  39161  39163  39181  39191  39199  39209  39217  39227  39229  39233  39239  39241  39251  39293  39301  39313  39317  39323  39341  39343  39359  39367  39371  39373  39383  39397  39409  39419  39439  39443  39451  39461  39499  39503  39509  39511  39521  39541  39551  39563  39569  39581  39607  39619  39623  39631  39659  39667  39671  39679  39703  39709  39719  39727  39733  39749  39761  39769  39779  39791  39799  39821  39827  39829  39839  39841  39847  39857  39863  39869  39877  39883  39887  39901  39929  39937  39953  39971  39979  39983  39989  40009  40013  40031  40037  40039  40063  40087  40093  40099  40111  40123  40127  40129  40151  40153  40163  40169  40177  40189  40193  40213  40231  40237  40241  40253  40277  40283  40289  40343  40351  40357  40361  40387  40423  40427  40429  40433  40459  40471  40483  40487  40493  40499  40507  40519  40529  40531  40543  40559  40577  40583  40591  40597  40609  40627  40637  40639  40693  40697  40699  40709  40739  40751  40759  40763  40771  40787  40801  40813  40819  40823  40829  40841  40847  40849  40853  40867  40879  40883  40897  40903  40927  40933  40939  40949  40961  40973  40993  41011  41017  41023  41039  41047  41051  41057  41077  41081  41113  41117  41131  41141  41143  41149  41161  41177  41179  41183  41189  41201  41203  41213  41221  41227  41231  41233  41243  41257  41263  41269  41281  41299  41333  41341  41351  41357  41381  41387  41389  41399  41411  41413  41443  41453  41467  41479  41491  41507  41513  41519  41521  41539  41543  41549  41579  41593  41597  41603  41609  41611  41617  41621  41627  41641  41647  41651  41659  41669  41681  41687  41719  41729  41737  41759  41761  41771  41777  41801  41809  41813  41843  41849  41851  41863  41879  41887  41893  41897  41903  41911  41927  41941  41947  41953  41957  41959  41969  41981  41983  41999  42013  42017  42019  42023  42043  42061  42071  42073  42083  42089  42101  42131  42139  42157  42169  42179  42181  42187  42193  42197  42209  42221  42223  42227  42239  42257  42281  42283  42293  42299  42307  42323  42331  42337  42349  42359  42373  42379  42391  42397  42403  42407  42409  42433  42437  42443  42451  42457  42461  42463  42467  42473  42487  42491  42499  42509  42533  42557  42569  42571  42577  42589  42611  42641  42643  42649  42667  42677  42683  42689  42697  42701  42703  42709  42719  42727  42737  42743  42751  42767  42773  42787  42793  42797  42821  42829  42839  42841  42853  42859  42863  42899  42901  42923  42929  42937  42943  42953  42961  42967  42979  42989  43003  43013  43019  43037  43049  43051  43063  43067  43093  43103  43117  43133  43151  43159  43177  43189  43201  43207  43223  43237  43261  43271  43283  43291  43313  43319  43321  43331  43391  43397  43399  43403  43411  43427  43441  43451  43457  43481  43487  43499  43517  43541  43543  43573  43577  43579  43591  43597  43607  43609  43613  43627  43633  43649  43651  43661  43669  43691  43711  43717  43721  43753  43759  43777  43781  43783  43787  43789  43793  43801  43853  43867  43889  43891  43913  43933  43943  43951  43961  43963  43969  43973  43987  43991  43997  44017  44021  44027  44029  44041  44053  44059  44071  44087  44089  44101  44111  44119  44123  44129  44131  44159  44171  44179  44189  44201  44203  44207  44221  44249  44257  44263  44267  44269  44273  44279  44281  44293  44351  44357  44371  44381  44383  44389  44417  44449  44453  44483  44491  44497  44501  44507  44519  44531  44533  44537  44543  44549  44563  44579  44587  44617  44621  44623  44633  44641  44647  44651  44657  44683  44687  44699  44701  44711  44729  44741  44753  44771  44773  44777  44789  44797  44809  44819  44839  44843  44851  44867  44879  44887  44893  44909  44917  44927  44939  44953  44959  44963  44971  44983  44987  45007  45013  45053  45061  45077  45083  45119  45121  45127  45131  45137  45139  45161  45179  45181  45191  45197  45233  45247  45259  45263  45281  45289  45293  45307  45317  45319  45329  45337  45341  45343  45361  45377  45389  45403  45413  45427  45433  45439  45481  45491  45497  45503  45523  45533  45541  45553  45557  45569  45587  45589  45599  45613  45631  45641  45659  45667  45673  45677  45691  45697  45707  45737  45751  45757  45763  45767  45779  45817  45821  45823  45827  45833  45841  45853  45863  45869  45887  45893  45943  45949  45953  45959  45971  45979  45989  46021  46027  46049  46051  46061  46073  46091  46093  46099  46103  46133  46141  46147  46153  46171  46181  46183  46187  46199  46219  46229  46237  46261  46271  46273  46279  46301  46307  46309  46327  46337  46349  46351  46381  46399  46411  46439  46441  46447  46451  46457  46471  46477  46489  46499  46507  46511  46523  46549  46559  46567  46573  46589  46591  46601  46619  46633  46639  46643  46649  46663  46679  46681  46687  46691  46703  46723  46727  46747  46751  46757  46769  46771  46807  46811  46817  46819  46829  46831  46853  46861  46867  46877  46889  46901  46919  46933  46957  46993  46997  47017  47041  47051  47057  47059  47087  47093  47111  47119  47123  47129  47137  47143  47147  47149  47161  47189  47207  47221  47237  47251  47269  47279  47287  47293  47297  47303  47309  47317  47339  47351  47353  47363  47381  47387  47389  47407  47417  47419  47431  47441  47459  47491  47497  47501  47507  47513  47521  47527  47533  47543  47563  47569  47581  47591  47599  47609  47623  47629  47639  47653  47657  47659  47681  47699  47701  47711  47713  47717  47737  47741  47743  47777  47779  47791  47797  47807  47809  47819  47837  47843  47857  47869  47881  47903  47911  47917  47933  47939  47947  47951  47963  47969  47977  47981  48017  48023  48029  48049  48073  48079  48091  48109  48119  48121  48131  48157  48163  48179  48187  48193  48197  48221  48239  48247  48259  48271  48281  48299  48311  48313  48337  48341  48353  48371  48383  48397  48407  48409  48413  48437  48449  48463  48473  48479  48481  48487  48491  48497  48523  48527  48533  48539  48541  48563  48571  48589  48593  48611  48619  48623  48647  48649  48661  48673  48677  48679  48731  48733  48751  48757  48761  48767  48779  48781  48787  48799  48809  48817  48821  48823  48847  48857  48859  48869  48871  48883  48889  48907  48947  48953  48973  48989  48991  49003  49009  49019  49031  49033  49037  49043  49057  49069  49081  49103  49109  49117  49121  49123  49139  49157  49169  49171  49177  49193  49199  49201  49207  49211  49223  49253  49261  49277  49279  49297  49307  49331  49333  49339  49363  49367  49369  49391  49393  49409  49411  49417  49429  49433  49451  49459  49463  49477  49481  49499  49523  49529  49531  49537  49547  49549  49559  49597  49603  49613  49627  49633  49639  49663  49667  49669  49681  49697  49711  49727  49739  49741  49747  49757  49783  49787  49789  49801  49807  49811  49823  49831  49843  49853  49871  49877  49891  49919  49921  49927  49937  49939  49943  49957  49991  49993  49999  50021  50023  50033  50047  50051  50053  50069  50077  50087  50093  50101  50111  50119  50123  50129  50131  50147  50153  50159  50177  50207  50221  50227  50231  50261  50263  50273  50287  50291  50311  50321  50329  50333  50341  50359  50363  50377  50383  50387  50411  50417  50423  50441  50459  50461  50497  50503  50513  50527  50539  50543  50549  50551  50581  50587  50591  50593  50599  50627  50647  50651  50671  50683  50707  50723  50741  50753  50767  50773  50777  50789  50821  50833  50839  50849  50857  50867  50873  50891  50893  50909  50923  50929  50951  50957  50969  50971  50989  50993  51001  51031  51043  51047  51059  51061  51071  51109  51131  51133  51137  51151  51157  51169  51193  51197  51199  51203  51217  51229  51239  51241  51257  51263  51283  51287  51307  51329  51341  51343  51347  51349  51361  51383  51407  51413  51419  51421  51427  51431  51437  51439  51449  51461  51473  51479  51481  51487  51503  51511  51517  51521  51539  51551  51563  51577  51581  51593  51599  51607  51613  51631  51637  51647  51659  51673  51679  51683  51691  51713  51719  51721  51749  51767  51769  51787  51797  51803  51817  51827  51829  51839  51853  51859  51869  51871  51893  51899  51907  51913  51929  51941  51949  51971  51973  51977  51991  52009  52021  52027  52051  52057  52067  52069  52081  52103  52121  52127  52147  52153  52163  52177  52181  52183  52189  52201  52223  52237  52249  52253  52259  52267  52289  52291  52301  52313  52321  52361  52363  52369  52379  52387  52391  52433  52453  52457  52489  52501  52511  52517  52529  52541  52543  52553  52561  52567  52571  52579  52583  52609  52627  52631  52639  52667  52673  52691  52697  52709  52711  52721  52727  52733  52747  52757  52769  52783  52807  52813  52817  52837  52859  52861  52879  52883  52889  52901  52903  52919  52937  52951  52957  52963  52967  52973  52981  52999  53003  53017  53047  53051  53069  53077  53087  53089  53093  53101  53113  53117  53129  53147  53149  53161  53171  53173  53189  53197  53201  53231  53233  53239  53267  53269  53279  53281  53299  53309  53323  53327  53353  53359  53377  53381  53401  53407  53411  53419  53437  53441  53453  53479  53503  53507  53527  53549  53551  53569  53591  53593  53597  53609  53611  53617  53623  53629  53633  53639  53653  53657  53681  53693  53699  53717  53719  53731  53759  53773  53777  53783  53791  53813  53819  53831  53849  53857  53861  53881  53887  53891  53897  53899  53917  53923  53927  53939  53951  53959  53987  53993  54001  54011  54013  54037  54049  54059  54083  54091  54101  54121  54133  54139  54151  54163  54167  54181  54193  54217  54251  54269  54277  54287  54293  54311  54319  54323  54331  54347  54361  54367  54371  54377  54401  54403  54409  54413  54419  54421  54437  54443  54449  54469  54493  54497  54499  54503  54517  54521  54539  54541  54547  54559  54563  54577  54581  54583  54601  54617  54623  54629  54631  54647  54667  54673  54679  54709  54713  54721  54727  54751  54767  54773  54779  54787  54799  54829  54833  54851  54869  54877  54881  54907  54917  54919  54941  54949  54959  54973  54979  54983  55001  55009  55021  55049  55051  55057  55061  55073  55079  55103  55109  55117  55127  55147  55163  55171  55201  55207  55213  55217  55219  55229  55243  55249  55259  55291  55313  55331  55333  55337  55339  55343  55351  55373  55381  55399  55411  55439  55441  55457  55469  55487  55501  55511  55529  55541  55547  55579  55589  55603  55609  55619  55621  55631  55633  55639  55661  55663  55667  55673  55681  55691  55697  55711  55717  55721  55733  55763  55787  55793  55799  55807  55813  55817  55819  55823  55829  55837  55843  55849  55871  55889  55897  55901  55903  55921  55927  55931  55933  55949  55967  55987  55997  56003  56009  56039  56041  56053  56081  56087  56093  56099  56101  56113  56123  56131  56149  56167  56171  56179  56197  56207  56209  56237  56239  56249  56263  56267  56269  56299  56311  56333  56359  56369  56377  56383  56393  56401  56417  56431  56437  56443  56453  56467  56473  56477  56479  56489  56501  56503  56509  56519  56527  56531  56533  56543  56569  56591  56597  56599  56611  56629  56633  56659  56663  56671  56681  56687  56701  56711  56713  56731  56737  56747  56767  56773  56779  56783  56807  56809  56813  56821  56827  56843  56857  56873  56891  56893  56897  56909  56911  56921  56923  56929  56941  56951  56957  56963  56983  56989  56993  56999  57037  57041  57047  57059  57073  57077  57089  57097  57107  57119  57131  57139  57143  57149  57163  57173  57179  57191  57193  57203  57221  57223  57241  57251  57259  57269  57271  57283  57287  57301  57329  57331  57347  57349  57367  57373  57383  57389  57397  57413  57427  57457  57467  57487  57493  57503  57527  57529  57557  57559  57571  57587  57593  57601  57637  57641  57649  57653  57667  57679  57689  57697  57709  57713  57719  57727  57731  57737  57751  57773  57781  57787  57791  57793  57803  57809  57829  57839  57847  57853  57859  57881  57899  57901  57917  57923  57943  57947  57973  57977  57991  58013  58027  58031  58043  58049  58057  58061  58067  58073  58099  58109  58111  58129  58147  58151  58153  58169  58171  58189  58193  58199  58207  58211  58217  58229  58231  58237  58243  58271  58309  58313  58321  58337  58363  58367  58369  58379  58391  58393  58403  58411  58417  58427  58439  58441  58451  58453  58477  58481  58511  58537  58543  58549  58567  58573  58579  58601  58603  58613  58631  58657  58661  58679  58687  58693  58699  58711  58727  58733  58741  58757  58763  58771  58787  58789  58831  58889  58897  58901  58907  58909  58913  58921  58937  58943  58963  58967  58979  58991  58997  59009  59011  59021  59023  59029  59051  59053  59063  59069  59077  59083  59093  59107  59113  59119  59123  59141  59149  59159  59167  59183  59197  59207  59209  59219  59221  59233  59239  59243  59263  59273  59281  59333  59341  59351  59357  59359  59369  59377  59387  59393  59399  59407  59417  59419  59441  59443  59447  59453  59467  59471  59473  59497  59509  59513  59539  59557  59561  59567  59581  59611  59617  59621  59627  59629  59651  59659  59663  59669  59671  59693  59699  59707  59723  59729  59743  59747  59753  59771  59779  59791  59797  59809  59833  59863  59879  59887  59921  59929  59951  59957  59971  59981  59999  60013  60017  60029  60037  60041  60077  60083  60089  60091  60101  60103  60107  60127  60133  60139  60149  60161  60167  60169  60209  60217  60223  60251  60257  60259  60271  60289  60293  60317  60331  60337  60343  60353  60373  60383  60397  60413  60427  60443  60449  60457  60493  60497  60509  60521  60527  60539  60589  60601  60607  60611  60617  60623  60631  60637  60647  60649  60659  60661  60679  60689  60703  60719  60727  60733  60737  60757  60761  60763  60773  60779  60793  60811  60821  60859  60869  60887  60889  60899  60901  60913  60917  60919  60923  60937  60943  60953  60961  61001  61007  61027  61031  61043  61051  61057  61091  61099  61121  61129  61141  61151  61153  61169  61211  61223  61231  61253  61261  61283  61291  61297  61331  61333  61339  61343  61357  61363  61379  61381  61403  61409  61417  61441  61463  61469  61471  61483  61487  61493  61507  61511  61519  61543  61547  61553  61559  61561  61583  61603  61609  61613  61627  61631  61637  61643  61651  61657  61667  61673  61681  61687  61703  61717  61723  61729  61751  61757  61781  61813  61819  61837  61843  61861  61871  61879  61909  61927  61933  61949  61961  61967  61979  61981  61987  61991  62003  62011  62017  62039  62047  62053  62057  62071  62081  62099  62119  62129  62131  62137  62141  62143  62171  62189  62191  62201  62207  62213  62219  62233  62273  62297  62299  62303  62311  62323  62327  62347  62351  62383  62401  62417  62423  62459  62467  62473  62477  62483  62497  62501  62507  62533  62539  62549  62563  62581  62591  62597  62603  62617  62627  62633  62639  62653  62659  62683  62687  62701  62723  62731  62743  62753  62761  62773  62791  62801  62819  62827  62851  62861  62869  62873  62897  62903  62921  62927  62929  62939  62969  62971  62981  62983  62987  62989  63029  63031  63059  63067  63073  63079  63097  63103  63113  63127  63131  63149  63179  63197  63199  63211  63241  63247  63277  63281  63299  63311  63313  63317  63331  63337  63347  63353  63361  63367  63377  63389  63391  63397  63409  63419  63421  63439  63443  63463  63467  63473  63487  63493  63499  63521  63527  63533  63541  63559  63577  63587  63589  63599  63601  63607  63611  63617  63629  63647  63649  63659  63667  63671  63689  63691  63697  63703  63709  63719  63727  63737  63743  63761  63773  63781  63793  63799  63803  63809  63823  63839  63841  63853  63857  63863  63901  63907  63913  63929  63949  63977  63997  64007  64013  64019  64033  64037  64063  64067  64081  64091  64109  64123  64151  64153  64157  64171  64187  64189  64217  64223  64231  64237  64271  64279  64283  64301  64303  64319  64327  64333  64373  64381  64399  64403  64433  64439  64451  64453  64483  64489  64499  64513  64553  64567  64577  64579  64591  64601  64609  64613  64621  64627  64633  64661  64663  64667  64679  64693  64709  64717  64747  64763  64781  64783  64793  64811  64817  64849  64853  64871  64877  64879  64891  64901  64919  64921  64927  64937  64951  64969  64997  65003  65011  65027  65029  65033  65053  65063  65071  65089  65099  65101  65111  65119  65123  65129  65141  65147  65167  65171  65173  65179  65183  65203  65213  65239  65257  65267  65269  65287  65293  65309  65323  65327  65353  65357  65371  65381  65393  65407  65413  65419  65423  65437  65447  65449  65479  65497  65519  65521  65537  65539  65543  65551  65557  65563  65579  65581  65587  65599  65609  65617  65629  65633  65647  65651  65657  65677  65687  65699  65701  65707  65713  65717  65719  65729  65731  65761  65777  65789  65809  65827  65831  65837  65839  65843  65851  65867  65881  65899  65921  65927  65929  65951  65957  65963  65981  65983  65993  66029  66037  66041  66047  66067  66071  66083  66089  66103  66107  66109  66137  66161  66169  66173  66179  66191  66221  66239  66271  66293  66301  66337  66343  66347  66359  66361  66373  66377  66383  66403  66413  66431  66449  66457  66463  66467  66491  66499  66509  66523  66529  66533  66541  66553  66569  66571  66587  66593  66601  66617  66629  66643  66653  66683  66697  66701  66713  66721  66733  66739  66749  66751  66763  66791  66797  66809  66821  66841  66851  66853  66863  66877  66883  66889  66919  66923  66931  66943  66947  66949  66959  66973  66977  67003  67021  67033  67043  67049  67057  67061  67073  67079  67103  67121  67129  67139  67141  67153  67157  67169  67181  67187  67189  67211  67213  67217  67219  67231  67247  67261  67271  67273  67289  67307  67339  67343  67349  67369  67391  67399  67409  67411  67421  67427  67429  67433  67447  67453  67477  67481  67489  67493  67499  67511  67523  67531  67537  67547  67559  67567  67577  67579  67589  67601  67607  67619  67631  67651  67679  67699  67709  67723  67733  67741  67751  67757  67759  67763  67777  67783  67789  67801  67807  67819  67829  67843  67853  67867  67883  67891  67901  67927  67931  67933  67939  67943  67957  67961  67967  67979  67987  67993  68023  68041  68053  68059  68071  68087  68099  68111  68113  68141  68147  68161  68171  68207  68209  68213  68219  68227  68239  68261  68279  68281  68311  68329  68351  68371  68389  68399  68437  68443  68447  68449  68473  68477  68483  68489  68491  68501  68507  68521  68531  68539  68543  68567  68581  68597  68611  68633  68639  68659  68669  68683  68687  68699  68711  68713  68729  68737  68743  68749  68767  68771  68777  68791  68813  68819  68821  68863  68879  68881  68891  68897  68899  68903  68909  68917  68927  68947  68963  68993  69001  69011  69019  69029  69031  69061  69067  69073  69109  69119  69127  69143  69149  69151  69163  69191  69193  69197  69203  69221  69233  69239  69247  69257  69259  69263  69313  69317  69337  69341  69371  69379  69383  69389  69401  69403  69427  69431  69439  69457  69463  69467  69473  69481  69491  69493  69497  69499  69539  69557  69593  69623  69653  69661  69677  69691  69697  69709  69737  69739  69761  69763  69767  69779  69809  69821  69827  69829  69833  69847  69857  69859  69877  69899  69911  69929  69931  69941  69959  69991  69997  70001  70003  70009  70019  70039  70051  70061  70067  70079  70099  70111  70117  70121  70123  70139  70141  70157  70163  70177  70181  70183  70199  70201  70207  70223  70229  70237  70241  70249  70271  70289  70297  70309  70313  70321  70327  70351  70373  70379  70381  70393  70423  70429  70439  70451  70457  70459  70481  70487  70489  70501  70507  70529  70537  70549  70571  70573  70583  70589  70607  70619  70621  70627  70639  70657  70663  70667  70687  70709  70717  70729  70753  70769  70783  70793  70823  70841  70843  70849  70853  70867  70877  70879  70891  70901  70913  70919  70921  70937  70949  70951  70957  70969  70979  70981  70991  70997  70999  71011  71023  71039  71059  71069  71081  71089  71119  71129  71143  71147  71153  71161  71167  71171  71191  71209  71233  71237  71249  71257  71261  71263  71287  71293  71317  71327  71329  71333  71339  71341  71347  71353  71359  71363  71387  71389  71399  71411  71413  71419  71429  71437  71443  71453  71471  71473  71479  71483  71503  71527  71537  71549  71551  71563  71569  71593  71597  71633  71647  71663  71671  71693  71699  71707  71711  71713  71719  71741  71761  71777  71789  71807  71809  71821  71837  71843  71849  71861  71867  71879  71881  71887  71899  71909  71917  71933  71941  71947  71963  71971  71983  71987  71993  71999  72019  72031  72043  72047  72053  72073  72077  72089  72091  72101  72103  72109  72139  72161  72167  72169  72173  72211  72221  72223  72227  72229  72251  72253  72269  72271  72277  72287  72307  72313  72337  72341  72353  72367  72379  72383  72421  72431  72461  72467  72469  72481  72493  72497  72503  72533  72547  72551  72559  72577  72613  72617  72623  72643  72647  72649  72661  72671  72673  72679  72689  72701  72707  72719  72727  72733  72739  72763  72767  72797  72817  72823  72859  72869  72871  72883  72889  72893  72901  72907  72911  72923  72931  72937  72949  72953  72959  72973  72977  72997  73009  73013  73019  73037  73039  73043  73061  73063  73079  73091  73121  73127  73133  73141  73181  73189  73237  73243  73259  73277  73291  73303  73309  73327  73331  73351  73361  73363  73369  73379  73387  73417  73421  73433  73453  73459  73471  73477  73483  73517  73523  73529  73547  73553  73561  73571  73583  73589  73597  73607  73609  73613  73637  73643  73651  73673  73679  73681  73693  73699  73709  73721  73727  73751  73757  73771  73783  73819  73823  73847  73849  73859  73867  73877  73883  73897  73907  73939  73943  73951  73961  73973  73999  74017  74021  74027  74047  74051  74071  74077  74093  74099  74101  74131  74143  74149  74159  74161  74167  74177  74189  74197  74201  74203  74209  74219  74231  74257  74279  74287  74293  74297  74311  74317  74323  74353  74357  74363  74377  74381  74383  74411  74413  74419  74441  74449  74453  74471  74489  74507  74509  74521  74527  74531  74551  74561  74567  74573  74587  74597  74609  74611  74623  74653  74687  74699  74707  74713  74717  74719  74729  74731  74747  74759  74761  74771  74779  74797  74821  74827  74831  74843  74857  74861  74869  74873  74887  74891  74897  74903  74923  74929  74933  74941  74959  75011  75013  75017  75029  75037  75041  75079  75083  75109  75133  75149  75161  75167  75169  75181  75193  75209  75211  75217  75223  75227  75239  75253  75269  75277  75289  75307  75323  75329  75337  75347  75353  75367  75377  75389  75391  75401  75403  75407  75431  75437  75479  75503  75511  75521  75527  75533  75539  75541  75553  75557  75571  75577  75583  75611  75617  75619  75629  75641  75653  75659  75679  75683  75689  75703  75707  75709  75721  75731  75743  75767  75773  75781  75787  75793  75797  75821  75833  75853  75869  75883  75913  75931  75937  75941  75967  75979  75983  75989  75991  75997  76001  76003  76031  76039  76079  76081  76091  76099  76103  76123  76129  76147  76157  76159  76163  76207  76213  76231  76243  76249  76253  76259  76261  76283  76289  76303  76333  76343  76367  76369  76379  76387  76403  76421  76423  76441  76463  76471  76481  76487  76493  76507  76511  76519  76537  76541  76543  76561  76579  76597  76603  76607  76631  76649  76651  76667  76673  76679  76697  76717  76733  76753  76757  76771  76777  76781  76801  76819  76829  76831  76837  76847  76871  76873  76883  76907  76913  76919  76943  76949  76961  76963  76991  77003  77017  77023  77029  77041  77047  77069  77081  77093  77101  77137  77141  77153  77167  77171  77191  77201  77213  77237  77239  77243  77249  77261  77263  77267  77269  77279  77291  77317  77323  77339  77347  77351  77359  77369  77377  77383  77417  77419  77431  77447  77471  77477  77479  77489  77491  77509  77513  77521  77527  77543  77549  77551  77557  77563  77569  77573  77587  77591  77611  77617  77621  77641  77647  77659  77681  77687  77689  77699  77711  77713  77719  77723  77731  77743  77747  77761  77773  77783  77797  77801  77813  77839  77849  77863  77867  77893  77899  77929  77933  77951  77969  77977  77983  77999  78007  78017  78031  78041  78049  78059  78079  78101  78121  78137  78139  78157  78163  78167  78173  78179  78191  78193  78203  78229  78233  78241  78259  78277  78283  78301  78307  78311  78317  78341  78347  78367  78401  78427  78437  78439  78467  78479  78487  78497  78509  78511  78517  78539  78541  78553  78569  78571  78577  78583  78593  78607  78623  78643  78649  78653  78691  78697  78707  78713  78721  78737  78779  78781  78787  78791  78797  78803  78809  78823  78839  78853  78857  78877  78887  78889  78893  78901  78919  78929  78941  78977  78979  78989  79031  79039  79043  79063  79087  79103  79111  79133  79139  79147  79151  79153  79159  79181  79187  79193  79201  79229  79231  79241  79259  79273  79279  79283  79301  79309  79319  79333  79337  79349  79357  79367  79379  79393  79397  79399  79411  79423  79427  79433  79451  79481  79493  79531  79537  79549  79559  79561  79579  79589  79601  79609  79613  79621  79627  79631  79633  79657  79669  79687  79691  79693  79697  79699  79757  79769  79777  79801  79811  79813  79817  79823  79829  79841  79843  79847  79861  79867  79873  79889  79901  79903  79907  79939  79943  79967  79973  79979  79987  79997  79999  80021  80039  80051  80071  80077  80107  80111  80141  80147  80149  80153  80167  80173  80177  80191  80207  80209  80221  80231  80233  80239  80251  80263  80273  80279  80287  80309  80317  80329  80341  80347  80363  80369  80387  80407  80429  80447  80449  80471  80473  80489  80491  80513  80527  80537  80557  80567  80599  80603  80611  80621  80627  80629  80651  80657  80669  80671  80677  80681  80683  80687  80701  80713  80737  80747  80749  80761  80777  80779  80783  80789  80803  80809  80819  80831  80833  80849  80863  80897  80909  80911  80917  80923  80929  80933  80953  80963  80989  81001  81013  81017  81019  81023  81031  81041  81043  81047  81049  81071  81077  81083  81097  81101  81119  81131  81157  81163  81173  81181  81197  81199  81203  81223  81233  81239  81281  81283  81293  81299  81307  81331  81343  81349  81353  81359  81371  81373  81401  81409  81421  81439  81457  81463  81509  81517  81527  81533  81547  81551  81553  81559  81563  81569  81611  81619  81629  81637  81647  81649  81667  81671  81677  81689  81701  81703  81707  81727  81737  81749  81761  81769  81773  81799  81817  81839  81847  81853  81869  81883  81899  81901  81919  81929  81931  81937  81943  81953  81967  81971  81973  82003  82007  82009  82013  82021  82031  82037  82039  82051  82067  82073  82129  82139  82141  82153  82163  82171  82183  82189  82193  82207  82217  82219  82223  82231  82237  82241  82261  82267  82279  82301  82307  82339  82349  82351  82361  82373  82387  82393  82421  82457  82463  82469  82471  82483  82487  82493  82499  82507  82529  82531  82549  82559  82561  82567  82571  82591  82601  82609  82613  82619  82633  82651  82657  82699  82721  82723  82727  82729  82757  82759  82763  82781  82787  82793  82799  82811  82813  82837  82847  82883  82889  82891  82903  82913  82939  82963  82981  82997  83003  83009  83023  83047  83059  83063  83071  83077  83089  83093  83101  83117  83137  83177  83203  83207  83219  83221  83227  83231  83233  83243  83257  83267  83269  83273  83299  83311  83339  83341  83357  83383  83389  83399  83401  83407  83417  83423  83431  83437  83443  83449  83459  83471  83477  83497  83537  83557  83561  83563  83579  83591  83597  83609  83617  83621  83639  83641  83653  83663  83689  83701  83717  83719  83737  83761  83773  83777  83791  83813  83833  83843  83857  83869  83873  83891  83903  83911  83921  83933  83939  83969  83983  83987  84011  84017  84047  84053  84059  84061  84067  84089  84121  84127  84131  84137  84143  84163  84179  84181  84191  84199  84211  84221  84223  84229  84239  84247  84263  84299  84307  84313  84317  84319  84347  84349  84377  84389  84391  84401  84407  84421  84431  84437  84443  84449  84457  84463  84467  84481  84499  84503  84509  84521  84523  84533  84551  84559  84589  84629  84631  84649  84653  84659  84673  84691  84697  84701  84713  84719  84731  84737  84751  84761  84787  84793  84809  84811  84827  84857  84859  84869  84871  84913  84919  84947  84961  84967  84977  84979  84991  85009  85021  85027  85037  85049  85061  85081  85087  85091  85093  85103  85109  85121  85133  85147  85159  85193  85199  85201  85213  85223  85229  85237  85243  85247  85259  85297  85303  85313  85331  85333  85361  85363  85369  85381  85411  85427  85429  85439  85447  85451  85453  85469  85487  85513  85517  85523  85531  85549  85571  85577  85597  85601  85607  85619  85621  85627  85639  85643  85661  85667  85669  85691  85703  85711  85717  85733  85751  85781  85793  85817  85819  85829  85831  85837  85843  85847  85853  85889  85903  85909  85931  85933  85991  85999  86011  86017  86027  86029  86069  86077  86083  86111  86113  86117  86131  86137  86143  86161  86171  86179  86183  86197  86201  86209  86239  86243  86249  86257  86263  86269  86287  86291  86293  86297  86311  86323  86341  86351  86353  86357  86369  86371  86381  86389  86399  86413  86423  86441  86453  86461  86467  86477  86491  86501  86509  86531  86533  86539  86561  86573  86579  86587  86599  86627  86629  86677  86689  86693  86711  86719  86729  86743  86753  86767  86771  86783  86813  86837  86843  86851  86857  86861  86869  86923  86927  86929  86939  86951  86959  86969  86981  86993  87011  87013  87037  87041  87049  87071  87083  87103  87107  87119  87121  87133  87149  87151  87179  87181  87187  87211  87221  87223  87251  87253  87257  87277  87281  87293  87299  87313  87317  87323  87337  87359  87383  87403  87407  87421  87427  87433  87443  87473  87481  87491  87509  87511  87517  87523  87539  87541  87547  87553  87557  87559  87583  87587  87589  87613  87623  87629  87631  87641  87643  87649  87671  87679  87683  87691  87697  87701  87719  87721  87739  87743  87751  87767  87793  87797  87803  87811  87833  87853  87869  87877  87881  87887  87911  87917  87931  87943  87959  87961  87973  87977  87991  88001  88003  88007  88019  88037  88069  88079  88093  88117  88129  88169  88177  88211  88223  88237  88241  88259  88261  88289  88301  88321  88327  88337  88339  88379  88397  88411  88423  88427  88463  88469  88471  88493  88499  88513  88523  88547  88589  88591  88607  88609  88643  88651  88657  88661  88663  88667  88681  88721  88729  88741  88747  88771  88789  88793  88799  88801  88807  88811  88813  88817  88819  88843  88853  88861  88867  88873  88883  88897  88903  88919  88937  88951  88969  88993  88997  89003  89009  89017  89021  89041  89051  89057  89069  89071  89083  89087  89101  89107  89113  89119  89123  89137  89153  89189  89203  89209  89213  89227  89231  89237  89261  89269  89273  89293  89303  89317  89329  89363  89371  89381  89387  89393  89399  89413  89417  89431  89443  89449  89459  89477  89491  89501  89513  89519  89521  89527  89533  89561  89563  89567  89591  89597  89599  89603  89611  89627  89633  89653  89657  89659  89669  89671  89681  89689  89753  89759  89767  89779  89783  89797  89809  89819  89821  89833  89839  89849  89867  89891  89897  89899  89909  89917  89923  89939  89959  89963  89977  89983  89989  90001  90007  90011  90017  90019  90023  90031  90053  90059  90067  90071  90073  90089  90107  90121  90127  90149  90163  90173  90187  90191  90197  90199  90203  90217  90227  90239  90247  90263  90271  90281  90289  90313  90353  90359  90371  90373  90379  90397  90401  90403  90407  90437  90439  90469  90473  90481  90499  90511  90523  90527  90529  90533  90547  90583  90599  90617  90619  90631  90641  90647  90659  90677  90679  90697  90703  90709  90731  90749  90787  90793  90803  90821  90823  90833  90841  90847  90863  90887  90901  90907  90911  90917  90931  90947  90971  90977  90989  90997  91009  91019  91033  91079  91081  91097  91099  91121  91127  91129  91139  91141  91151  91153  91159  91163  91183  91193  91199  91229  91237  91243  91249  91253  91283  91291  91297  91303  91309  91331  91367  91369  91373  91381  91387  91393  91397  91411  91423  91433  91453  91457  91459  91463  91493  91499  91513  91529  91541  91571  91573  91577  91583  91591  91621  91631  91639  91673  91691  91703  91711  91733  91753  91757  91771  91781  91801  91807  91811  91813  91823  91837  91841  91867  91873  91909  91921  91939  91943  91951  91957  91961  91967  91969  91997  92003  92009  92033  92041  92051  92077  92083  92107  92111  92119  92143  92153  92173  92177  92179  92189  92203  92219  92221  92227  92233  92237  92243  92251  92269  92297  92311  92317  92333  92347  92353  92357  92363  92369  92377  92381  92383  92387  92399  92401  92413  92419  92431  92459  92461  92467  92479  92489  92503  92507  92551  92557  92567  92569  92581  92593  92623  92627  92639  92641  92647  92657  92669  92671  92681  92683  92693  92699  92707  92717  92723  92737  92753  92761  92767  92779  92789  92791  92801  92809  92821  92831  92849  92857  92861  92863  92867  92893  92899  92921  92927  92941  92951  92957  92959  92987  92993  93001  93047  93053  93059  93077  93083  93089  93097  93103  93113  93131  93133  93139  93151  93169  93179  93187  93199  93229  93239  93241  93251  93253  93257  93263  93281  93283  93287  93307  93319  93323  93329  93337  93371  93377  93383  93407  93419  93427  93463  93479  93481  93487  93491  93493  93497  93503  93523  93529  93553  93557  93559  93563  93581  93601  93607  93629  93637  93683  93701  93703  93719  93739  93761  93763  93787  93809  93811  93827  93851  93871  93887  93889  93893  93901  93911  93913  93923  93937  93941  93949  93967  93971  93979  93983  93997  94007  94009  94033  94049  94057  94063  94079  94099  94109  94111  94117  94121  94151  94153  94169  94201  94207  94219  94229  94253  94261  94273  94291  94307  94309  94321  94327  94331  94343  94349  94351  94379  94397  94399  94421  94427  94433  94439  94441  94447  94463  94477  94483  94513  94529  94531  94541  94543  94547  94559  94561  94573  94583  94597  94603  94613  94621  94649  94651  94687  94693  94709  94723  94727  94747  94771  94777  94781  94789  94793  94811  94819  94823  94837  94841  94847  94849  94873  94889  94903  94907  94933  94949  94951  94961  94993  94999  95003  95009  95021  95027  95063  95071  95083  95087  95089  95093  95101  95107  95111  95131  95143  95153  95177  95189  95191  95203  95213  95219  95231  95233  95239  95257  95261  95267  95273  95279  95287  95311  95317  95327  95339  95369  95383  95393  95401  95413  95419  95429  95441  95443  95461  95467  95471  95479  95483  95507  95527  95531  95539  95549  95561  95569  95581  95597  95603  95617  95621  95629  95633  95651  95701  95707  95713  95717  95723  95731  95737  95747  95773  95783  95789  95791  95801  95803  95813  95819  95857  95869  95873  95881  95891  95911  95917  95923  95929  95947  95957  95959  95971  95987  95989  96001  96013  96017  96043  96053  96059  96079  96097  96137  96149  96157  96167  96179  96181  96199  96211  96221  96223  96233  96259  96263  96269  96281  96289  96293  96323  96329  96331  96337  96353  96377  96401  96419  96431  96443  96451  96457  96461  96469  96479  96487  96493  96497  96517  96527  96553  96557  96581  96587  96589  96601  96643  96661  96667  96671  96697  96703  96731  96737  96739  96749  96757  96763  96769  96779  96787  96797  96799  96821  96823  96827  96847  96851  96857  96893  96907  96911  96931  96953  96959  96973  96979  96989  96997  97001  97003  97007  97021  97039  97073  97081  97103  97117  97127  97151  97157  97159  97169  97171  97177  97187  97213  97231  97241  97259  97283  97301  97303  97327  97367  97369  97373  97379  97381  97387  97397  97423  97429  97441  97453  97459  97463  97499  97501  97511  97523  97547  97549  97553  97561  97571  97577  97579  97583  97607  97609  97613  97649  97651  97673  97687  97711  97729  97771  97777  97787  97789  97813  97829  97841  97843  97847  97849  97859  97861  97871  97879  97883  97919  97927  97931  97943  97961  97967  97973  97987  98009  98011  98017  98041  98047  98057  98081  98101  98123  98129  98143  98179  98207  98213  98221  98227  98251  98257  98269  98297  98299  98317  98321  98323  98327  98347  98369  98377  98387  98389  98407  98411  98419  98429  98443  98453  98459  98467  98473  98479  98491  98507  98519  98533  98543  98561  98563  98573  98597  98621  98627  98639  98641  98663  98669  98689  98711  98713  98717  98729  98731  98737  98773  98779  98801  98807  98809  98837  98849  98867  98869  98873  98887  98893  98897  98899  98909  98911  98927  98929  98939  98947  98953  98963  98981  98993  98999  99013  99017  99023  99041  99053  99079  99083  99089  99103  99109  99119  99131  99133  99137  99139  99149  99173  99181  99191  99223  99233  99241  99251  99257  99259  99277  99289  99317  99347  99349  99367  99371  99377  99391  99397  99401  99409  99431  99439  99469  99487  99497  99523  99527  99529  99551  99559  99563  99571  99577  99581  99607  99611  99623  99643  99661  99667  99679  99689  99707  99709  99713  99719  99721  99733  99761  99767  99787  99793  99809  99817  99823  99829  99833  99839  99859  99871  99877  99881  99901  99907  99923  99929  99961  99971  99989  99991

==== u1388_variable_names_and_data_type_54409 | variable_names_and_data_types-advanced | tutorial.txt line 54409 | expected: none
print (0.1 + 0.2) - 0.3

start timer
for i = 1 to 10_000
  num$ = str$(i)
next i
print 'Seconds:'; _elapsed

// Demonstrate string optimizations in action
print "String Assignment (SID optimization):"
company$ = "Acme Corporation"
customer_company$ = company$    // Fast SID-based assignment
print "Company: "; company$
print "Customer company: "; customer_company$
print

print "Concatenation (memoization):"
prefix$ = "Customer ID: "
id$ = "456-78"
for idx = 1 to 100_000
    result$ = prefix$ + id$  // Cached after first iteration
next idx
print result$
print

message$ = "all is good"
print "Copy-on-write literals:"
message$ = "System ready"       // Points to literal
status$ = message$              // Shares literal's SID
print "Message: "; message$
print "Status: "; status$

const last_term =10_000
previous = 0
current  = 1
print f$("The Fibonacci series, F(1) through F([[last_term+1]]):")
print

start timer
for term = 1 to last_term
  if mod(term,100) = 0 then print  sprintf$("F(%) = %m", term, current)
  next_value = previous + current
  previous   = current
  current    = next_value
next term
print  sprintf$("F(%) = %m", term, current)

print 'Elapsed secs:';_elapsed

delay
---- output
 0 
Seconds: 0 
String Assignment (SID optimization):
Company: Acme Corporation
Customer company: Acme Corporation

Concatenation (memoization):
Customer ID: 456-78

Copy-on-write literals:
Message: System ready
Status: System ready
The Fibonacci series, F(1) through F(10001):

F(100) = 354,224,848,179,261,915,075
F(200) = 280,571,172,992,510,140,037,611,932,413,038,677,189,525
F(300) = 222,232,244,629,420,445,529,739,893,461,909,967,206,666,939,096,499,764,990,979,600
F(400) = 1.760236806450139664682269453924112507703843833044921918867259928e+83
F(500) = 1.394232245616978801397243828704072839500702565876973072641089627e+104
F(600) = 1.104330705729522423464322467677182859425902373575556063800088916e+125
F(700) = 8.747081495575284620397841301757132734236724096769738107423043228e+145
F(800) = 6.928308186422471713629007768132851827339912438520482071896604032e+166
F(900) = 5.487710883948000005141367394838371444380051930912359272449495318e+187
F(1000) = 4.346655768693745643568852767504062580256466051737178040248172885e+208
F(1100) = 3.442859285241027194008361307091963063578189472401787439654596413e+229
F(1200) = 2.726988445540627015799161531364219870500077999291772582118050277e+250
F(1300) = 2.159968028316171580784705206654043342288351577211965806376649888e+271
F(1400) = 1.710847690234022724124971951323182147738274989802692004155088367e+292
F(1500) = 1.35511256685631019516369368671484083777860107124184972421335431e+313
F(1600) = 1.073345148918961110312160904303871047716692524192564541342409932e+334
F(1700) = 8.501653935514177120246392248625833924052052390491381030300605937e+354
F(1800) = 6.7339121728029334726063530018469450746582873788843260894776016e+375
F(1900) = 5.333735470177196739708654380013216364182711606231750028692155574e+396
F(2000) = 4.224696333392304878706725602341482782579852840250681098010280114e+417
F(2100) = 3.346258772894381788558434639941537877209053265053766990305264812e+438
F(2200) = 2.650473996596436536356196798944232122138617049795750388692937491e+459
F(2300) = 2.099363164480411228108950195076642780142024754952279098975840866e+480
F(2400) = 1.662844344836735778495351734269869348602181054179831348870097031e+501
F(2500) = 1.317090516751949629522763087125316412066606964992507141887746928e+522
F(2600) = 1.043228991760043347210890372985818906605196329708252845141385754e+543
F(2700) = 8.263112636575481509685747394723903534186117817570656972064261978e+563
F(2800) = 6.544970565814039211539503323058051436658741363008196652268165646e+584
F(2900) = 5.18408033284720218183254536552037385968869923410570504549274234e+605
F(3000) = 4.106158863079712603335683787192671052201251086373692524088854291e+626
F(3100) = 3.25236869923038533197130573145590928542790328737066447507601071e+647
F(3200) = 2.576106407095969325553617849584699271124184283216668095270447843e+668
F(3300) = 2.040458765407277174092426427245929904940513767897679557192549788e+689
F(3400) = 1.616187887992114808210245725761445398570528703918051811225644568e+710
F(3500) = 1.280135297794681361535851368251019615389004811220654459648376509e+731
F(3600) = 1.013957840443779382666841062753085367837928040433335374145482932e+752
F(3700) = 8.03126438251146165632903138498865059541448230055998670916150727e+772
F(3800) = 6.361330324500172220894738649447220178332107279931928848532915728e+793
F(3900) = 5.038624252679769806929910129893391548800580998347776832445843936e+814
F(4000) = 3.990947343500442279208124809496091260079257098282025785262887631e+835
F(4100) = 3.161113014157025502880137109007092241588365925521748835648832605e+856
F(4200) = 2.503825439978974638020145090821104155728314551138722626062403474e+877
F(4300) = 1.983207119077866613848002438152742896649457780540515578207766085e+898
F(4400) = 1.570840528401276607190272595408288564264255768308009064928975276e+919
F(4500) = 1.244216976598660009311270917708920361214744344663049873800557205e+940
F(4600) = 9.855079856081031596667951928544382162241698129975980469385169517e+960
F(4700) = 7.805921378378878251008269956405485511275125916824177421311736962e+981
F(4800) = 6.182842701962921663662479424783289375544006898912546481398406301e+1002
F(4900) = 4.897249411594150502822528288221474361321597951150780484441551755e+1023
F(5000) = 3.878968454388325633701916308325905312082127714646245106160597197e+1044
F(5100) = 3.072417801412703523949464074712147330367477157628765140228371748e+1065
F(5200) = 2.433572548330049478204907535471068862203460626208131491929226579e+1086
F(5300) = 1.927561852187725765088052502602079859168558738436860868084003135e+1107
F(5400) = 1.526765535122015923837364896113820094377637249241134632065010794e+1128
F(5500) = 1.209306459655644637193336214982299006475290230992509331547308173e+1149
F(5600) = 9.578563831335081447666711864094590544223271018110610828564491439e+1169
F(5700) = 7.586901098426820231697239710839721588821810777429864725117648114e+1190
F(5800) = 6.009363124877469460146679726840111110176207674892427747967218104e+1211
F(5900) = 4.759841297275535941605865906005308637657880622608400697395802134e+1232
F(6000) = 3.770131493877999453339002248807757912361173379301004455354900443e+1253
F(6100) = 2.986211218694745340694105665720531200519955739313125021350838171e+1274
F(6200) = 2.365290827956178166812106765722058353237058151037535425861188892e+1295
F(6300) = 1.873477892584901804834157553081278672352735405552764988057588093e+1316
F(6400) = 1.483927207817081712203482259236478497081704359956417204792897308e+1337
F(6500) = 1.175375469769525939088804311254988238752786319741037015998065258e+1358
F(6600) = 9.30980635477523482764910922669995152083836067066384381337817581e+1378
F(6700) = 7.374026138252533299734779029188068113579717064557926095112168226e+1399
F(6800) = 5.840751076389533214123057381140189116027975521842628022606839517e+1420
F(6900) = 4.626288610421141814359355494310232697630749781646750973527844552e+1441
F(7000) = 3.664348305037232832276358967281604921857154393417598962627069892e+1462
F(7100) = 2.902423439467800363486022628623508705130467134114810108540133944e+1483
F(7200) = 2.298924971294861860260793600364074552813522285803770794827236621e+1504
F(7300) = 1.820911432761916307713213300913871327067525840914963913702514958e+1525
F(7400) = 1.442290847837233872055127733173672945813862369455163139249537659e+1546
F(7500) = 1.142396523152058704722048892865690419848718663331756079795903064e+1567
F(7600) = 9.048589735329115751374095917247663386801570197308107911281174958e+1587
F(7700) = 7.167124071105493115702002078918658609151501736670908876555704058e+1608
F(7800) = 5.676869982298012786307333012903340943302254482091524121665424979e+1629
F(7900) = 4.496483174588801113274374684076954369303577691032876075093876327e+1650
F(8000) = 3.561533204460626739768914905427460387141369539110154082973500657e+1671
F(8100) = 2.820986596404993113489485369237832836115753575665511843686389976e+1692
F(8200) = 2.234421222615504034024009899974428564967952652167533888733232953e+1713
F(8300) = 1.769819894372089021702383272964758659256389305674188622884377029e+1734
F(8400) = 1.401822730115658021019934237560234507180550128055886077293727617e+1755
F(8500) = 1.110342907161247323779202179864051794839593114826146524371580428e+1776
F(8600) = 8.794702389948923899242680969298090490717865187957330634108845927e+1796
F(8700) = 6.966027308223330802162682106810843358968275429594232328264555758e+1817
F(8800) = 5.517587100431149510665176678771367216988133752042379769203903594e+1838
F(8900) = 4.370319848575045654864251083535289776203678703967644026062190183e+1859
F(9000) = 3.461602912866847463132892729406531958210049388405746491977923576e+1880
F(9100) = 2.741834726416015628028525553917508011291558633923918926852337337e+1901
F(9200) = 2.171727334477765466081072955312984464497614852219392015290112602e+1922
F(9300) = 1.720161893741470531492457336078436270337129983286137481899937028e+1943
F(9400) = 1.362490075850973034509665119199882226668742432050961854399492661e+1964
F(9500) = 1.079188658664352625923313529735970646812542385179614849843374708e+1985
F(9600) = 8.547938672231121177071138648494222066399304913168949729572828564e+2005
F(9700) = 6.770572963086484143585537373079350784771653200016225626777137173e+2026
F(9800) = 5.362773413126593764824422208415238715319776845050337480191915765e+2047
F(9900) = 4.247696441251702900020429136256615616137784277296230733022811384e+2068
F(10000) = 3.364476487643178326662161200510754331030214846068006390656477011e+2089
F(10001) = 5.443837311356528133873426099375038013538918455469596702624771606e+2089
Elapsed secs: 0

==== u1389_spvm_hints_56463 | spvm-hints | tutorial.txt line 56463 | expected: none
start timer
for i = 1 to 100_000
  a$ = "my name is "
  b$ = "Sally Sue "
  c$ = "and I am 25 years old"
  d$ = " the end"
  x$ = a$ + b$ + c$ + d$
next i
print 'Elapsed time: '; _elapsed

delay
---- output
Elapsed time:  0.047

