Tyl Programming Language
▶ CONDITIONAL LOOPING
Conditional looping is the repeating of code execution while the condition is met.

Conditional looping format:
[ON] ~
Conditional looping line:
``` on ~ ```
The variable: `on`, is a local boolean variable of the looping statement, that is set to TRUE, and the execution of the repeat block, will continue until the value of `on` will be FALSE.

Conditional looping statement:
``` print num 5 on ~  num > 0 ? num -- 13 ╌ num ++ 17  print num  num 0 ? on ｆ ᐤ ```
5
-8
9
-4
13
0
`num` is drawn to zero, with jumps of up: 17, and down: 13, until it reaches zero. The line: '`num 0 ? on ｆ`', is responsible for the looping to stop.

If we try the above code, with up: 4, down: 2, and num: 1, we see that the sequence will be: 1, -1, 3, 1, -1 ...., that is, it will never reach zero.
The astute readers will notice that the program mechanism creates a cyclic sequence anyway, thus, if after some iterations there wasn't a zero, we can safely assume that it will loop forever without reaching zero.

The solution is to use a stop counter that will stop the looping:
``` print num 5 stop_ctr 100 on ~  num > 0 ? num -- 13 ╌ num ++ 17  print num  not num ? on ｆ  not stop_ctr -- ? on ｆ ᐤ ```
The line: '`not num ? on ｆ`', will check if `num` is not zero, if TRUE it will set `on` to FALSE, causing the loop to stop.
Likewise, the statement condition: '`not stop_ctr --`', will decrement `stop_ctr`, until it reaches zero. That will ignite the `not` function to return TRUE, and the looping will be stopped.

If we define the number of iterations it takes `num` to reach zero as the `attraction` of `num`, it constructs a mapping:
`num → attraction`
We can try different starting numbers to try and find a specific attraction.

Here's Zero Attraction Searcher program:
``` main »  attraction 8  num_ctr 0  num_stop_ctr 30  attact_stop_ctr 30  nums  checked_num  attract_str  newline '\n'  attract_found ｆ  nums_on ~   checked_num num num_ctr ++   nums ►►   nums ◄ num   stop_ctr attract_stop_ctr   attract_on ~    num > 0 ? num -- 13 ╌ num ++ 17    num ? nums ◄ num ╌ attract_on ｆ    not stop_ctr -- ?     attract_on ｆ     nums_on ｆ    ᐤ   ᐤ   nums_len len nums   attract_str ++ checked_num + ': ' + nums_len + newline   nums_len attraction ?    attract_found ｔ    nums_on ｆ   ᐤ   num_ctr num_stop_ctr ? nums_on ｆ  ᐤ  attract_found ?   print attract_str + newline   print 'attraction: ' attraction   print 'start number: ' checked_num   print 'sequence: '   print nums   ╌   print 'Zero was not reached!'  ᐤ ```
1: 7
2: 14
3: 21
4: 28
5: 5
6: 12
7: 19
8: 26
9: 3
10: 10
11: 17
12: 24
13: 1
14: 8

attraction: 8
start number: 14
sequence:
[ 14, 1, -12, 5, -8, 9, -4, 13 ]

PART 3