File: yabasic.htm

package info (click to toggle)
yabasic 1%3A2.91.1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,168 kB
  • sloc: ansic: 12,434; sh: 4,417; makefile: 21
file content (9131 lines) | stat: -rwxr-xr-x 640,971 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Yabasic</title>
    <link rel="stylesheet" type="text/css" href="docbook.css"/>
    <link rel="stylesheet" type="text/css" href="docbook.css"/>
    <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"/>
  </head>
  <body>
    <div class="book" id="id1337"><div class="titlepage"><div><div><h1 class="title">Yabasic</h1></div></div><hr/></div><div class="toc"><div class="toc-title">Table of Contents</div><ul class="toc"><li><span class="chapter"><a href="#chapter_intoduction">1. Introduction</a></span><ul><li><span class="section"><a href="#id1338">About this document</a></span></li><li><span class="section"><a href="#id1339">About <span class="application">yabasic</span></a></span></li></ul></li><li><span class="chapter"><a href="#chapter_program_windows">2. The <span class="application">yabasic</span>-program under Windows</a></span><ul><li><span class="section"><a href="#id1340">Starting <span class="application">yabasic</span></a></span></li><li><span class="section"><a href="#id1341">Options</a></span></li><li><span class="section"><a href="#id1342">The context Menu</a></span></li></ul></li><li><span class="chapter"><a href="#chapter_program_unix">3. The <span class="application">yabasic</span>-program under Unix</a></span><ul><li><span class="section"><a href="#id1343">Starting <span class="application">yabasic</span></a></span></li><li><span class="section"><a href="#id1344">Options</a></span></li><li><span class="section"><a href="#id1345">Setting defaults</a></span></li></ul></li><li><span class="chapter"><a href="#chapter_options">4. Command line options of <span class="application">yabasic</span></a></span></li><li><span class="chapter"><a href="#chapter_topics_list">5. All commands and functions of <span class="application">yabasic</span> listed by topic</a></span><ul><li><span class="section"><a href="#top_numbers_with_base_2_or_16">Numbers with base 2 or 16</a></span></li><li><span class="section"><a href="#top_numbers">Number processing and conversion</a></span></li><li><span class="section"><a href="#top_conditions">Conditions and control structures</a></span></li><li><span class="section"><a href="#top_data">Data keeping and processing</a></span></li><li><span class="section"><a href="#top_strings">String processing</a></span></li><li><span class="section"><a href="#top_io">File operations and printing</a></span></li><li><span class="section"><a href="#top_sub">Subroutines</a></span></li><li><span class="section"><a href="#top_lib">Libraries</a></span></li><li><span class="section"><a href="#top_outside">Invoking other program from within yabasic</a></span></li><li><span class="section"><a href="#top_add_code">Adding new code to a running program</a></span></li><li><span class="section"><a href="#top_time_and_timing">Commands and functions related with time</a></span></li><li><span class="section"><a href="#top_other">Other commands</a></span></li><li><span class="section"><a href="#top_graphics">Graphics and printing</a></span></li><li><span class="section"><a href="#top_ffi">The foreign function interface</a></span></li></ul></li><li><span class="chapter"><a href="#chapter_ref_concepts">6. Some features and general concepts of <span class="application">yabasic</span></a></span><ul><li><span class="section"><a href="#ref_logical_shortcuts">Logical shortcuts</a></span></li><li><span class="section"><a href="#ref_conditions_and_expressions">Conditions and expressions</a></span></li><li><span class="section"><a href="#ref_comparing_strings_or_numbers">Comparing strings or numbers</a></span></li><li><span class="section"><a href="#ref_array_references">References on arrays</a></span><ul><li><span class="section"><a href="#id1346">An example</a></span></li></ul></li><li><span class="section"><a href="#ref_windows_filenames">Specifying Filenames under Windows</a></span></li><li><span class="section"><a href="#ref_escape_sequences">Escape-sequences</a></span></li><li><span class="section"><a href="#ref_subroutines">Subroutines: Sharing code within one program</a></span><ul><li><span class="section"><a href="#id1347">Purpose</a></span></li><li><span class="section"><a href="#id1348">A simple example</a></span></li><li><span class="section"><a href="#id1349">See also</a></span></li></ul></li><li><span class="section"><a href="#ref_libraries">Libraries: Sharing code between many programs</a></span><ul><li><span class="section"><a href="#id1350">Purpose</a></span></li><li><span class="section"><a href="#id1351">A simple example</a></span></li><li><span class="section"><a href="#id1352">Namespaces</a></span></li><li><span class="section"><a href="#id1353">See also</a></span></li></ul></li><li><span class="section"><a href="#ref_add_code">Adding code to a running program</a></span><ul><li><span class="section"><a href="#id1354">Purpose</a></span></li><li><span class="section"><a href="#id1355">How the various functions and commands differ</a></span></li></ul></li><li><span class="section"><a href="#ref_standalone">Creating a <span class="emphasis"><em>standalone</em></span> program from your yabasic-program</a></span><ul><li><span class="section"><a href="#id1356">Creating a standalone-program from the command line</a></span></li><li><span class="section"><a href="#id1357">Creating a standalone-program from within your program</a></span></li><li><span class="section"><a href="#id1358">Points to consider before creating a standalone program</a></span></li><li><span class="section"><a href="#id1359">See also</a></span></li></ul></li><li><span class="section"><a href="#ffi">Interaction with functions from a non-<span class="application">yabasic</span> library or dll</a></span><ul><li><span class="section"><a href="#background_ffi">Some Background</a></span></li><li><span class="section"><a href="#id1365">Three simple examples</a></span></li><li><span class="section"><a href="#steps_during_foreign_call">Internal steps during a call to a foreign function</a></span></li><li><span class="section"><a href="#id1366">Abbreviations for long names</a></span></li><li><span class="section"><a href="#structures_and_buffers">Structurs and buffers</a></span></li><li><span class="section"><a href="#id1368">Two more complex examples</a></span></li><li><span class="section"><a href="#id1369">See also</a></span></li></ul></li></ul></li><li><span class="chapter"><a href="#chapter_ref_words">7. All commands and functions of <span class="application">yabasic</span> grouped alphabetically</a></span><ul><li><span class="section"><a href="#ref_a">A</a></span><ul><li><span class="refentrytitle"><a href="#ref_abs">abs()</a></span><span class="refpurpose"> &#8212; returns the absolute value of its numeric argument</span></li><li><span class="refentrytitle"><a href="#ref_acos">acos()</a></span><span class="refpurpose"> &#8212; returns the arcus cosine of its numeric argument</span></li><li><span class="refentrytitle"><a href="#ref_logical_and">and</a></span><span class="refpurpose"> &#8212; logical and, used in conditions</span></li><li><span class="refentrytitle"><a href="#ref_bitwise_and">and()</a></span><span class="refpurpose"> &#8212; the bitwise arithmetic <code class="function">and</code></span></li><li><span class="refentrytitle"><a href="#ref_arraydim">arraydim()</a></span><span class="refpurpose"> &#8212; returns the dimension of the array, which is passed as an array reference</span></li><li><span class="refentrytitle"><a href="#ref_arraysize">arraysize()</a></span><span class="refpurpose"> &#8212; returns the size of a dimension of an array</span></li><li><span class="refentrytitle"><a href="#ref_asc">asc()</a></span><span class="refpurpose"> &#8212; accepts a string and returns the position of its first character within the <abbr class="acronym">ascii</abbr> charset</span></li><li><span class="refentrytitle"><a href="#ref_asin">asin()</a></span><span class="refpurpose"> &#8212; returns the arcus sine of its numeric argument</span></li><li><span class="refentrytitle"><a href="#ref_at">at()</a></span><span class="refpurpose"> &#8212; can be used in the commands <code class="function">print</code> and input to place the output at a specified position</span></li><li><span class="refentrytitle"><a href="#ref_atan">atan()</a></span><span class="refpurpose"> &#8212; returns the arctangent of its numeric argument</span></li></ul></li><li><span class="section"><a href="#ref_b">B</a></span><ul><li><span class="refentrytitle"><a href="#ref_backcolor">backcolor</a></span><span class="refpurpose"> &#8212; change color for background of graphic window</span></li><li><span class="refentrytitle"><a href="#ref_beep">beep</a></span><span class="refpurpose"> &#8212; ring the bell within your computer; a synonym for <code class="function">bell</code></span></li><li><span class="refentrytitle"><a href="#ref_bell">bell</a></span><span class="refpurpose"> &#8212; ring the bell within your computer (just as <code class="function">beep</code>)</span></li><li><span class="refentrytitle"><a href="#ref_bin">bin$()</a></span><span class="refpurpose"> &#8212; converts a number into a sequence of binary digits</span></li><li><span class="refentrytitle"><a href="#ref_bind">bind()</a></span><span class="refpurpose"> &#8212; binds a <span class="application">yabasic</span>-program and the <span class="application">yabasic</span>-interpreter together into a <span class="emphasis"><em>standalone</em></span> program</span></li><li><span class="refentrytitle"><a href="#ref_bitnot">bitnot()</a></span><span class="refpurpose"> &#8212; the bitwise arithmetic <code class="function">not</code></span></li><li><span class="refentrytitle"><a href="#ref_box">box</a></span><span class="refpurpose"> &#8212; draw a rectangle. A synonym for <code class="function">rectangle</code></span></li><li><span class="refentrytitle"><a href="#ref_break">break</a></span><span class="refpurpose"> &#8212; breaks out of one or more loops or switch statements</span></li></ul></li><li><span class="section"><a href="#ref_c">C</a></span><ul><li><span class="refentrytitle"><a href="#ref_case">case</a></span><span class="refpurpose"> &#8212; mark the different cases within a switch-statement</span></li><li><span class="refentrytitle"><a href="#ref_ceil">ceil()</a></span><span class="refpurpose"> &#8212; compute the ceiling for its (float) argument</span></li><li><span class="refentrytitle"><a href="#ref_chomp">chomp$()</a></span><span class="refpurpose"> &#8212; remove a single trailing newline from its string-argument; if the string does not end in a newline, the string is returned unchanged</span></li><li><span class="refentrytitle"><a href="#ref_chr">chr$()</a></span><span class="refpurpose"> &#8212; accepts a number and returns the character at this position within the <abbr class="acronym">ascii</abbr> charset</span></li><li><span class="refentrytitle"><a href="#ref_circle">circle</a></span><span class="refpurpose"> &#8212; draws a circle in the graphic-window</span></li><li><span class="refentrytitle"><a href="#ref_clear">clear</a></span><span class="refpurpose"> &#8212; erase <code class="function">circle</code>s, <code class="function">rectangle</code>s or <code class="function">triangle</code>s</span></li><li><span class="refentrytitle"><a href="#ref_clear_screen">clear screen</a></span><span class="refpurpose"> &#8212; erases the text window</span></li><li><span class="refentrytitle"><a href="#ref_clear_window">clear window</a></span><span class="refpurpose"> &#8212; clear the graphic window and begin a new page, if printing is under way</span></li><li><span class="refentrytitle"><a href="#ref_close">close</a></span><span class="refpurpose"> &#8212; close a file, which has been opened before</span></li><li><span class="refentrytitle"><a href="#ref_close_curve">close curve</a></span><span class="refpurpose"> &#8212; close a curve, that has been drawn by the <code class="function">line</code>-command</span></li><li><span class="refentrytitle"><a href="#ref_close_printer">close printer</a></span><span class="refpurpose"> &#8212; stops printing of graphics</span></li><li><span class="refentrytitle"><a href="#ref_close_window">close window</a></span><span class="refpurpose"> &#8212; close the graphics-window</span></li><li><span class="refentrytitle"><a href="#ref_color">color</a></span><span class="refpurpose"> &#8212; change color for any subsequent drawing-command</span></li><li><span class="refentrytitle"><a href="#ref_compile">compile</a></span><span class="refpurpose"> &#8212; compile a string with <abbr class="acronym">yabasic</abbr>-code <span class="emphasis"><em>on the fly</em></span></span></li><li><span class="refentrytitle"><a href="#ref_continue">continue</a></span><span class="refpurpose"> &#8212; start the next iteration of a <code class="function">for</code>-, <code class="function">do</code>-, <code class="function">repeat</code>- or <code class="function">while</code>-loop</span></li><li><span class="refentrytitle"><a href="#ref_cos">cos()</a></span><span class="refpurpose"> &#8212; return the cosine of its single argument</span></li></ul></li><li><span class="section"><a href="#ref_d">D</a></span><ul><li><span class="refentrytitle"><a href="#ref_data">data</a></span><span class="refpurpose"> &#8212; introduces a list of data-items</span></li><li><span class="refentrytitle"><a href="#ref_date">date$</a></span><span class="refpurpose"> &#8212; returns a string with various components of the current date</span></li><li><span class="refentrytitle"><a href="#ref_dec">dec()</a></span><span class="refpurpose"> &#8212; convert a base 2 or base 16 number into decimal form</span></li><li><span class="refentrytitle"><a href="#ref_default">default</a></span><span class="refpurpose"> &#8212; mark the <span class="emphasis"><em>default</em></span>-branch within a switch-statement</span></li><li><span class="refentrytitle"><a href="#ref_dim">dim</a></span><span class="refpurpose"> &#8212; create an array prior to its first use</span></li><li><span class="refentrytitle"><a href="#ref_do">do</a></span><span class="refpurpose"> &#8212; start a (conditionless) <code class="function">do-loop</code></span></li><li><span class="refentrytitle"><a href="#ref_doc">doc</a></span><span class="refpurpose"> &#8212; special comment, which might be retrieved by the program itself</span></li><li><span class="refentrytitle"><a href="#ref_docu">docu$</a></span><span class="refpurpose"> &#8212; special array, containing the contents of all docu-statement within the program</span></li><li><span class="refentrytitle"><a href="#ref_dot">dot</a></span><span class="refpurpose"> &#8212; draw a dot in the graphic-window</span></li></ul></li><li><span class="section"><a href="#ref_e">E</a></span><ul><li><span class="refentrytitle"><a href="#ref_else">else</a></span><span class="refpurpose"> &#8212; mark an alternative within an <code class="function">if</code>-statement</span></li><li><span class="refentrytitle"><a href="#ref_elsif">elsif</a></span><span class="refpurpose"> &#8212; starts an alternate condition within an <code class="function">if</code>-statement</span></li><li><span class="refentrytitle"><a href="#ref_end">end</a></span><span class="refpurpose"> &#8212; terminate your program</span></li><li><span class="refentrytitle"><a href="#ref_endif">endif</a></span><span class="refpurpose"> &#8212; ends an <code class="function">if</code>-statement</span></li><li><span class="refentrytitle"><a href="#ref_end_sub">end sub</a></span><span class="refpurpose"> &#8212; ends a subroutine definition</span></li><li><span class="refentrytitle"><a href="#ref_eof">eof</a></span><span class="refpurpose"> &#8212; check, if an open file contains data</span></li><li><span class="refentrytitle"><a href="#ref_eor">eor()</a></span><span class="refpurpose"> &#8212; compute the bitwise <span class="emphasis"><em>exclusive or</em></span> of its two arguments</span></li><li><span class="refentrytitle"><a href="#ref_error">error</a></span><span class="refpurpose"> &#8212; raise an error and terminate your program</span></li><li><span class="refentrytitle"><a href="#ref_euler">euler</a></span><span class="refpurpose"> &#8212; another name for the constant <code class="function">2.71828182864</code></span></li><li><span class="refentrytitle"><a href="#ref_eval">eval()</a></span><span class="refpurpose"> &#8212; compile and execute a single numeric expression</span></li><li><span class="refentrytitle"><a href="#ref_eval2">eval$()</a></span><span class="refpurpose"> &#8212; compile and execute a single string-expression</span></li><li><span class="refentrytitle"><a href="#ref_execute">execute()</a></span><span class="refpurpose"> &#8212; execute a user defined subroutine, which must return a number</span></li><li><span class="refentrytitle"><a href="#ref_execute2">execute$()</a></span><span class="refpurpose"> &#8212; execute a user defined subroutine, which must return a string</span></li><li><span class="refentrytitle"><a href="#ref_exit">exit</a></span><span class="refpurpose"> &#8212; terminate your program</span></li><li><span class="refentrytitle"><a href="#ref_exp">exp()</a></span><span class="refpurpose"> &#8212; compute the exponential function of its single argument</span></li><li><span class="refentrytitle"><a href="#ref_export">export</a></span><span class="refpurpose"> &#8212; mark a function as globally visible</span></li></ul></li><li><span class="section"><a href="#ref_f">F</a></span><ul><li><span class="refentrytitle"><a href="#ref_false">false</a></span><span class="refpurpose"> &#8212; a constant with the value of 0</span></li><li><span class="refentrytitle"><a href="#ref_fi">fi</a></span><span class="refpurpose"> &#8212; another name for endif</span></li><li><span class="refentrytitle"><a href="#ref_fill">fill</a></span><span class="refpurpose"> &#8212; draw a filled <code class="function">circle</code>s, <code class="function">rectangle</code>s or <code class="function">triangle</code>s</span></li><li><span class="refentrytitle"><a href="#ref_floor">floor()</a></span><span class="refpurpose"> &#8212; compute the floor for its (float) argument</span></li><li><span class="refentrytitle"><a href="#ref_for">for</a></span><span class="refpurpose"> &#8212; starts a <code class="function">for</code>-loop</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_alloc">foreign_buffer_alloc$()</a></span><span class="refpurpose"> &#8212; Create a new buffer for use in a foreign function call</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_dump">foreign_buffer_dump$()</a></span><span class="refpurpose"> &#8212; return the content of a buffer as a hex-encoded string</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_free">foreign_buffer_free</a></span><span class="refpurpose"> &#8212; free a foreign buffer</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_get">foreign_buffer_get()</a></span><span class="refpurpose"> &#8212; extract a number from a foreign buffer</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_get2">foreign_buffer_get$()</a></span><span class="refpurpose"> &#8212; extract a string from a foreign buffer</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_get_buffer">foreign_buffer_get_buffer$()</a></span><span class="refpurpose"> &#8212; take a buffer and construct a handle to a second buffer from its content</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_set">foreign_buffer_set</a></span><span class="refpurpose"> &#8212; store a given value within a buffer</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_set_buffer">foreign_buffer_set_buffer</a></span><span class="refpurpose"> &#8212; store a pointer to one buffer within another buffer</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_size">foreign_buffer_size()</a></span><span class="refpurpose"> &#8212; return the size of the foreign buffer</span></li><li><span class="refentrytitle"><a href="#ref_foreign_function_call">foreign_function_call()</a></span><span class="refpurpose"> &#8212; call a function (returning a number) from a non-<span class="application">yabasic</span> library or dll</span></li><li><span class="refentrytitle"><a href="#ref_foreign_function_call2">foreign_function_call$()</a></span><span class="refpurpose"> &#8212; call a function (returning a string or a buffer) from a non-<span class="application">yabasic</span> library or dll</span></li><li><span class="refentrytitle"><a href="#ref_foreign_function_size">foreign_function_size()</a></span><span class="refpurpose"> &#8212; return the size of one of the types available for foreign function calls</span></li><li><span class="refentrytitle"><a href="#ref_frn">frnbf_ and frnfn_</a></span><span class="refpurpose"> &#8212; Abbreviations for <code class="literal">foreign_buffer_</code> and <code class="literal">foreign_function_</code></span></li><li><span class="refentrytitle"><a href="#ref_frac">frac()</a></span><span class="refpurpose"> &#8212; return the fractional part of its numeric argument</span></li></ul></li><li><span class="section"><a href="#ref_g">G</a></span><ul><li><span class="refentrytitle"><a href="#ref_getbit">getbit$()</a></span><span class="refpurpose"> &#8212; return a string representing the bit pattern of a rectangle within the graphic window</span></li><li><span class="refentrytitle"><a href="#ref_getscreen">getscreen$()</a></span><span class="refpurpose"> &#8212; returns a string representing a rectangular section of the text terminal</span></li><li><span class="refentrytitle"><a href="#ref_glob">glob()</a></span><span class="refpurpose"> &#8212; check if a string matches a simple pattern</span></li><li><span class="refentrytitle"><a href="#ref_gosub">gosub</a></span><span class="refpurpose"> &#8212; continue execution at another point within your program (and return later)</span></li><li><span class="refentrytitle"><a href="#ref_goto">goto</a></span><span class="refpurpose"> &#8212; continue execution at another point within your program (and never come back)</span></li></ul></li><li><span class="section"><a href="#ref_h">H</a></span><ul><li><span class="refentrytitle"><a href="#ref_hex">hex$()</a></span><span class="refpurpose"> &#8212; convert a number into hexadecimal</span></li></ul></li><li><span class="section"><a href="#ref_i">I</a></span><ul><li><span class="refentrytitle"><a href="#ref_if">if</a></span><span class="refpurpose"> &#8212; evaluate a condition and execute statements or not, depending on the result</span></li><li><span class="refentrytitle"><a href="#ref_import">import</a></span><span class="refpurpose"> &#8212; import a library</span></li><li><span class="refentrytitle"><a href="#ref_inkey">inkey$</a></span><span class="refpurpose"> &#8212; wait, until a key is pressed</span></li><li><span class="refentrytitle"><a href="#ref_input">input</a></span><span class="refpurpose"> &#8212; read input from user or  file and assign it to a variable</span></li><li><span class="refentrytitle"><a href="#ref_instr">instr()</a></span><span class="refpurpose"> &#8212; searches its second argument within the first; returns its position if found</span></li><li><span class="refentrytitle"><a href="#ref_int">int()</a></span><span class="refpurpose"> &#8212; return the integer part of its single numeric argument</span></li></ul></li><li><span class="section"><a href="#ref_l">L</a></span><ul><li><span class="refentrytitle"><a href="#ref_label">label</a></span><span class="refpurpose"> &#8212; mark a specific location within your program for <code class="function">goto</code>, <code class="function">gosub</code> or <code class="function">restore</code></span></li><li><span class="refentrytitle"><a href="#ref_left">left$()</a></span><span class="refpurpose"> &#8212; return (<span class="emphasis"><em>or change</em></span>) left end of a string</span></li><li><span class="refentrytitle"><a href="#ref_len">len()</a></span><span class="refpurpose"> &#8212; return the length of a string</span></li><li><span class="refentrytitle"><a href="#ref_line">line</a></span><span class="refpurpose"> &#8212; draw a line</span></li><li><span class="refentrytitle"><a href="#ref_line_input">line input</a></span><span class="refpurpose"> &#8212; read in a whole line of text and assign it to a variable</span></li><li><span class="refentrytitle"><a href="#ref_local">local</a></span><span class="refpurpose"> &#8212; mark a variable as local to a subroutine</span></li><li><span class="refentrytitle"><a href="#ref_log">log()</a></span><span class="refpurpose"> &#8212; compute the natural logarithm</span></li><li><span class="refentrytitle"><a href="#ref_loop">loop</a></span><span class="refpurpose"> &#8212; marks the end of an infinite loop</span></li><li><span class="refentrytitle"><a href="#ref_lower">lower$()</a></span><span class="refpurpose"> &#8212; convert a string to lower case</span></li><li><span class="refentrytitle"><a href="#ref_ltrim">ltrim$()</a></span><span class="refpurpose"> &#8212; trim spaces at the left end of a string</span></li></ul></li><li><span class="section"><a href="#ref_m">M</a></span><ul><li><span class="refentrytitle"><a href="#ref_max">max()</a></span><span class="refpurpose"> &#8212; return the larger of its two arguments</span></li><li><span class="refentrytitle"><a href="#ref_mid">mid$()</a></span><span class="refpurpose"> &#8212; return (<span class="emphasis"><em>or change</em></span>) characters from within a string</span></li><li><span class="refentrytitle"><a href="#ref_min">min()</a></span><span class="refpurpose"> &#8212; return the smaller of its two arguments</span></li><li><span class="refentrytitle"><a href="#ref_mod">mod</a></span><span class="refpurpose"> &#8212; compute the remainder of a division</span></li><li><span class="refentrytitle"><a href="#ref_mouseb">mouseb</a></span><span class="refpurpose"> &#8212; extract the state of the mousebuttons from a string returned by <code class="function">inkey$</code></span></li><li><span class="refentrytitle"><a href="#ref_mousemod">mousemod</a></span><span class="refpurpose"> &#8212; return the state of the modifier keys during a mouseclick</span></li><li><span class="refentrytitle"><a href="#ref_mousex">mousex</a></span><span class="refpurpose"> &#8212; return the x-position of a mouseclick</span></li><li><span class="refentrytitle"><a href="#ref_mousey">mousey</a></span><span class="refpurpose"> &#8212; return the y-position of a mouseclick</span></li></ul></li><li><span class="section"><a href="#ref_n">N</a></span><ul><li><span class="refentrytitle"><a href="#ref_new_curve">new curve</a></span><span class="refpurpose"> &#8212; start a new curve, that will be drawn with the <code class="function">line</code>-command</span></li><li><span class="refentrytitle"><a href="#ref_next">next</a></span><span class="refpurpose"> &#8212; mark the end of a for loop</span></li><li><span class="refentrytitle"><a href="#ref_logical_not">not</a></span><span class="refpurpose"> &#8212; negate a logical expression; can be written as <code class="function">!</code></span></li><li><span class="refentrytitle"><a href="#ref_numparams">numparams</a></span><span class="refpurpose"> &#8212; return the number of parameters, that have been passed to a subroutine</span></li></ul></li><li><span class="section"><a href="#ref_o">O</a></span><ul><li><span class="refentrytitle"><a href="#ref_on_gosub">on gosub</a></span><span class="refpurpose"> &#8212; jump to one of multiple <code class="function">gosub</code>-targets</span></li><li><span class="refentrytitle"><a href="#ref_on_goto">on goto</a></span><span class="refpurpose"> &#8212; jump to one of many <code class="function">goto</code>-targets</span></li><li><span class="refentrytitle"><a href="#ref_on_interrupt">on interrupt</a></span><span class="refpurpose"> &#8212; change reaction on keyboard interrupts</span></li><li><span class="refentrytitle"><a href="#ref_open">open</a></span><span class="refpurpose"> &#8212; open a file</span></li><li><span class="refentrytitle"><a href="#ref_open_printer">open printer</a></span><span class="refpurpose"> &#8212; open printer for printing graphics</span></li><li><span class="refentrytitle"><a href="#ref_open_window">open window</a></span><span class="refpurpose"> &#8212; open a graphic window</span></li><li><span class="refentrytitle"><a href="#ref_logical_or">logical or</a></span><span class="refpurpose"> &#8212; logical or, used in conditions</span></li><li><span class="refentrytitle"><a href="#ref_bitwise_or">or()</a></span><span class="refpurpose"> &#8212; arithmetic or, used for bit-operations</span></li></ul></li><li><span class="section"><a href="#ref_p">P</a></span><ul><li><span class="refentrytitle"><a href="#ref_pause">pause</a></span><span class="refpurpose"> &#8212; pause, sleep, wait for the specified number of seconds</span></li><li><span class="refentrytitle"><a href="#ref_peek">peek</a></span><span class="refpurpose"> &#8212; retrieve various internal informations (numeric)</span></li><li><span class="refentrytitle"><a href="#ref_peek2">peek$</a></span><span class="refpurpose"> &#8212; retrieve various internal informations (strings)</span></li><li><span class="refentrytitle"><a href="#ref_pi">pi</a></span><span class="refpurpose"> &#8212; a constant with the value <code class="computeroutput">3.14159</code></span></li><li><span class="refentrytitle"><a href="#ref_poke">poke</a></span><span class="refpurpose"> &#8212; change selected internals of <span class="application">yabasic</span></span></li><li><span class="refentrytitle"><a href="#ref_print">print</a></span><span class="refpurpose"> &#8212; Write to terminal or file</span></li><li><span class="refentrytitle"><a href="#ref_print_color">print or input with color</a></span><span class="refpurpose"> &#8212; print or input-prompt with color</span></li><li><span class="refentrytitle"><a href="#ref_print_colour">print colour</a></span><span class="refpurpose"> &#8212; see <code class="function">print color</code></span></li><li><span class="refentrytitle"><a href="#ref_putbit">putbit</a></span><span class="refpurpose"> &#8212; draw a rectangle of pixels encoded within a string into the graphics window</span></li><li><span class="refentrytitle"><a href="#ref_putscreen">putscreen</a></span><span class="refpurpose"> &#8212; draw a rectangle of characters into the text terminal</span></li></ul></li><li><span class="section"><a href="#ref_r">R</a></span><ul><li><span class="refentrytitle"><a href="#ref_ran">ran()</a></span><span class="refpurpose"> &#8212; return a random number</span></li><li><span class="refentrytitle"><a href="#ref_read">read</a></span><span class="refpurpose"> &#8212; read data from <code class="function">data</code>-statements</span></li><li><span class="refentrytitle"><a href="#ref_rectangle">rectangle</a></span><span class="refpurpose"> &#8212; draw a rectangle</span></li><li><span class="refentrytitle"><a href="#ref_redim">redim</a></span><span class="refpurpose"> &#8212; create an array prior to its first use. A synonym for <code class="function">dim</code></span></li><li><span class="refentrytitle"><a href="#ref_rem">rem</a></span><span class="refpurpose"> &#8212; start a comment</span></li><li><span class="refentrytitle"><a href="#ref_repeat">repeat</a></span><span class="refpurpose"> &#8212; start a <code class="function">repeat</code>-loop</span></li><li><span class="refentrytitle"><a href="#ref_restore">restore</a></span><span class="refpurpose"> &#8212; reposition the <code class="function">data</code>-pointer</span></li><li><span class="refentrytitle"><a href="#ref_return">return</a></span><span class="refpurpose"> &#8212; return from a subroutine or a gosub</span></li><li><span class="refentrytitle"><a href="#ref_reverse">reverse</a></span><span class="refpurpose"> &#8212; print reverse (background and foreground colors exchanged)</span></li><li><span class="refentrytitle"><a href="#ref_right">right$()</a></span><span class="refpurpose"> &#8212; return (<span class="emphasis"><em>or change</em></span>) the right end of a string</span></li><li><span class="refentrytitle"><a href="#ref_rinstr">rinstr()</a></span><span class="refpurpose"> &#8212; find the rightmost occurrence of one string within the other</span></li><li><span class="refentrytitle"><a href="#ref_round">round()</a></span><span class="refpurpose"> &#8212; round its argument to the nearest integer</span></li><li><span class="refentrytitle"><a href="#ref_rtrim">rtrim$()</a></span><span class="refpurpose"> &#8212; trim spaces at the right end of a string</span></li></ul></li><li><span class="section"><a href="#ref_s">S</a></span><ul><li><span class="refentrytitle"><a href="#ref_screen">screen</a></span><span class="refpurpose"> &#8212; as <code class="function">clear screen</code> clears the text window</span></li><li><span class="refentrytitle"><a href="#ref_seek">seek()</a></span><span class="refpurpose"> &#8212; change the position within an open file</span></li><li><span class="refentrytitle"><a href="#ref_sig">sig()</a></span><span class="refpurpose"> &#8212; return the sign of its argument</span></li><li><span class="refentrytitle"><a href="#ref_sin">sin()</a></span><span class="refpurpose"> &#8212; return the sine of its single argument</span></li><li><span class="refentrytitle"><a href="#ref_shl">shl()</a></span><span class="refpurpose"> &#8212; shift its argument bitwise to the left</span></li><li><span class="refentrytitle"><a href="#ref_shr">shr()</a></span><span class="refpurpose"> &#8212; shift its argument bitwise to the right</span></li><li><span class="refentrytitle"><a href="#ref_sleep">sleep</a></span><span class="refpurpose"> &#8212; pause, sleep, wait for the specified number of seconds</span></li><li><span class="refentrytitle"><a href="#ref_split">split()</a></span><span class="refpurpose"> &#8212; split a string into many strings</span></li><li><span class="refentrytitle"><a href="#ref_sqr">sqr()</a></span><span class="refpurpose"> &#8212; compute the square of its argument</span></li><li><span class="refentrytitle"><a href="#ref_sqrt">sqrt()</a></span><span class="refpurpose"> &#8212; compute the square root of its argument</span></li><li><span class="refentrytitle"><a href="#ref_static">static</a></span><span class="refpurpose"> &#8212; preserves the value of a variable between calls to a subroutine</span></li><li><span class="refentrytitle"><a href="#ref_step">step</a></span><span class="refpurpose"> &#8212; specifies the increment step in a for-loop</span></li><li><span class="refentrytitle"><a href="#ref_str">str$()</a></span><span class="refpurpose"> &#8212; convert a number into a string</span></li><li><span class="refentrytitle"><a href="#ref_string">string$()</a></span><span class="refpurpose"> &#8212; create a new string by repeating the given one a certain number of times</span></li><li><span class="refentrytitle"><a href="#ref_sub">sub</a></span><span class="refpurpose"> &#8212; declare a user defined subroutine</span></li><li><span class="refentrytitle"><a href="#ref_switch">switch</a></span><span class="refpurpose"> &#8212; select one of many alternatives depending on a value</span></li><li><span class="refentrytitle"><a href="#ref_system">system()</a></span><span class="refpurpose"> &#8212; hand the name of an external command over to your operating system and return its exitcode</span></li><li><span class="refentrytitle"><a href="#ref_system2">system$()</a></span><span class="refpurpose"> &#8212; hand the name of an external command over to your operating system and return its output</span></li></ul></li><li><span class="section"><a href="#ref_t">T</a></span><ul><li><span class="refentrytitle"><a href="#ref_tan">tan()</a></span><span class="refpurpose"> &#8212; return the tangent of its argument</span></li><li><span class="refentrytitle"><a href="#ref_tell">tell</a></span><span class="refpurpose"> &#8212; get the current position within an open file</span></li><li><span class="refentrytitle"><a href="#ref_text">text</a></span><span class="refpurpose"> &#8212; write text into your graphic-window</span></li><li><span class="refentrytitle"><a href="#ref_then">then</a></span><span class="refpurpose"> &#8212; tell the long from the short form of the <code class="function">if</code>-statement</span></li><li><span class="refentrytitle"><a href="#ref_time">time$</a></span><span class="refpurpose"> &#8212; return a string containing the current time</span></li><li><span class="refentrytitle"><a href="#ref_to">to</a></span><span class="refpurpose"> &#8212; this keyword appears as part of other statements</span></li><li><span class="refentrytitle"><a href="#ref_token">token()</a></span><span class="refpurpose"> &#8212; split a string into multiple strings</span></li><li><span class="refentrytitle"><a href="#ref_triangle">triangle</a></span><span class="refpurpose"> &#8212; draw a triangle</span></li><li><span class="refentrytitle"><a href="#ref_trim">trim$()</a></span><span class="refpurpose"> &#8212; remove leading and trailing spaces from its argument</span></li><li><span class="refentrytitle"><a href="#ref_true">true</a></span><span class="refpurpose"> &#8212; a constant with the value of 1</span></li></ul></li><li><span class="section"><a href="#ref_u">U</a></span><ul><li><span class="refentrytitle"><a href="#ref_until">until</a></span><span class="refpurpose"> &#8212; end a <code class="function">repeat</code>-loop</span></li><li><span class="refentrytitle"><a href="#ref_upper">upper$()</a></span><span class="refpurpose"> &#8212; convert a string to upper case</span></li><li><span class="refentrytitle"><a href="#ref_using">using</a></span><span class="refpurpose"> &#8212; Specify the format for printing a number</span></li></ul></li><li><span class="section"><a href="#ref_v">V</a></span><ul><li><span class="refentrytitle"><a href="#ref_val">val()</a></span><span class="refpurpose"> &#8212; converts a string to a number</span></li></ul></li><li><span class="section"><a href="#ref_w">W</a></span><ul><li><span class="refentrytitle"><a href="#ref_wait">wait</a></span><span class="refpurpose"> &#8212; pause, sleep, wait for the specified number of seconds</span></li><li><span class="refentrytitle"><a href="#ref_wend">wend</a></span><span class="refpurpose"> &#8212; end a while-loop</span></li><li><span class="refentrytitle"><a href="#ref_while">while</a></span><span class="refpurpose"> &#8212; start a <code class="function">while</code>-loop</span></li><li><span class="refentrytitle"><a href="#ref_origin">window origin</a></span><span class="refpurpose"> &#8212; move the origin of a window</span></li></ul></li><li><span class="section"><a href="#ref_x">X</a></span><ul><li><span class="refentrytitle"><a href="#ref_xor">xor()</a></span><span class="refpurpose"> &#8212; compute the exclusive or</span></li></ul></li><li><span class="section"><a href="#ref_special_characters">Symbols and Special characters</a></span><ul><li><span class="refentrytitle"><a href="#ref_hash">#</a></span><span class="refpurpose"> &#8212; either a comment or a marker for a file-number</span></li><li><span class="refentrytitle"><a href="#ref_double_slash">//</a></span><span class="refpurpose"> &#8212; starts a comment</span></li><li><span class="refentrytitle"><a href="#ref_at_sign">@</a></span><span class="refpurpose"> &#8212; synonymous to at</span></li><li><span class="refentrytitle"><a href="#ref_colon">:</a></span><span class="refpurpose"> &#8212; separate commands from each other</span></li><li><span class="refentrytitle"><a href="#ref_semicolon">;</a></span><span class="refpurpose"> &#8212; suppress the implicit newline after a print-statement</span></li><li><span class="refentrytitle"><a href="#ref_pow">** or ^</a></span><span class="refpurpose"> &#8212; raise its first argument to the power of its second</span></li><li><span class="refentrytitle"><a href="#ref_comparison">&lt; &lt;= &gt; &gt;= = == &lt;&gt; !=</a></span><span class="refpurpose"> &#8212; Compare numbers or strings</span></li></ul></li></ul></li><li><span class="chapter"><a href="#chapter_examples">8. A few example programs</a></span><ul><li><span class="section"><a href="#id1370">A very simple program</a></span></li><li><span class="section"><a href="#id1371">Graphics with bitmaps</a></span></li><li><span class="section"><a href="#id1372">A menu to choose from</a></span></li></ul></li><li><span class="chapter"><a href="#chapter_copyright">9. The Copyright of <span class="application">yabasic</span></a></span></li></ul></div>
  
  <section class="chapter" id="chapter_intoduction"><div class="titlepage"><div><div><h1 class="title">Chapter&#160;1.&#160;Introduction</h1></div></div></div><div class="toc"><ul class="toc"><li><span class="section"><a href="#id1338">About this document</a></span></li><li><span class="section"><a href="#id1339">About <span class="application">yabasic</span></a></span></li></ul></div>
    
    <section class="section" id="id1338"><div class="titlepage"><div><div><h2 class="title" style="clear: both">About this document</h2></div></div></div>
      
      <p>
      This document describes <span class="application">yabasic</span>.
      You will find information about the <span class="application">yabasic</span> 
      interpreter (the program <span class="command"><strong>yabasic</strong></span> under Unix or 
      <span class="command"><strong>yabasic.exe</strong></span> under Windows)
      as well as the language (which is, of course, a sort of <abbr class="acronym">basic</abbr>) itself.
    </p>
      <p>This document applies to version <span class="strong"><strong>2.91</strong></span> of <span class="application">yabasic</span></p>
      <p>
      However, it does <span class="emphasis"><em>not</em></span> contain the latest news about <span class="application">yabasic</span> or a FAQ.
      As such information tends to change rapidly, it is presented online only 
      at <a class="ulink" href="http://www.yabasic.de" target="_top">www.yabasic.de</a>.</p>
      <p>
      Although <abbr class="acronym">basic</abbr> has its reputation as a language for beginning programmers,
      this is not an introduction to programming at large. Rather this text assumes, that
      the reader has some (moderate) experience with writing and starting computer programs.</p>
      <p>
    </p>
    </section>

    <section class="section" id="id1339"><div class="titlepage"><div><div><h2 class="title" style="clear: both">About <span class="application">yabasic</span></h2></div></div></div>
      
      <p><span class="application">yabasic</span> is a traditional basic interpreter. It understands most of the typical basic-constructs, like <code class="function">goto</code>, <code class="function">gosub</code>, line numbers, <code class="function">read</code>, <code class="function">data</code> or string-variables with a trailing '<code class="literal">$</code>'. But on the other hand, <span class="application">yabasic</span> implements some more advanced programming-constructs like subroutines or libraries (but <span class="emphasis"><em>not</em></span> objects). <span class="application">yabasic</span> works much the same under Unix and Windows.</p>
      <p><span class="application">yabasic</span> puts emphasis on giving results quickly and easily; therefore simple commands are provided to open a graphic window, print the graphics or control the console screen and get keyboard or mouse information. The example below opens a window, draws a circle and prints the graphic:</p>
      <pre class="programlisting">
open window 100,100
open printer
circle 50,50,40
text 10,50,"Press any key to get a printout"
clear screen
inkey$
close printer
close window
</pre>
      <p>This example has fewer lines, than it would have in many other programming languages. In the end however <span class="application">yabasic</span> lacks behind more advanced and modern programming languages like C++ or Java. But as far as it goes it tends to give you results more quickly and easily.</p>
    </section>
  </section>


  <section class="chapter" id="chapter_program_windows"><div class="titlepage"><div><div><h1 class="title">Chapter&#160;2.&#160;The <span class="application">yabasic</span>-program under Windows</h1></div></div></div><div class="toc"><ul class="toc"><li><span class="section"><a href="#id1340">Starting <span class="application">yabasic</span></a></span></li><li><span class="section"><a href="#id1341">Options</a></span></li><li><span class="section"><a href="#id1342">The context Menu</a></span></li></ul></div>
    
    <section class="section" id="id1340"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Starting <span class="application">yabasic</span></h2></div></div></div>
      
      <p>Once, <span class="application">yabasic</span> has been set up correctly, there are three ways to start it:</p>
      <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
	  <p><span class="emphasis"><em>Right click on your desktop:</em></span> The desktop menu appears with a submenu named <span class="emphasis"><em>new</em></span>. From this submenu choose <span class="application">yabasic</span>. This will create a new icon on your desktop. If you right click on this icon, its <a class="link" href="#windows_context_menu">context menu</a> will appear; choose <span class="guilabel">Execute</span> to execute the program.</p>
	</li><li class="listitem">
	  <p>As a variant of the way described above, you may simply <span class="emphasis"><em>create a file with the ending <code class="filename">.yab</code></em></span> (e.g. with your favorite editor). Everything else then works as described above.</p>
	</li><li class="listitem">
	  <p><span class="emphasis"><em>From the start-menu:</em></span> Choose <span class="application">yabasic</span> from your start-menu. A console-window will open and you will be asked to type in your program. Once you are finished, you need to type <code class="literal">return</code> twice, and <span class="application">yabasic</span> will parse and execute your program.</p>
	  <div class="note"><h3 class="title">Note</h3>
	    <p>This is <span class="emphasis"><em>not</em></span> the preferred way of starting <span class="application">yabasic</span> ! Simply because the program, that you have typed, <span class="emphasis"><em>can not be saved</em></span> and will be lost inevitably ! There is no such thing as a <code class="function">save</code>-command and therefore no way to conserve the program, that you have typed. This mode is only intended for quick hacks, and short programs.</p>
	  </div>
	</li></ol></div>
    </section>

    <section class="section" id="id1341"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Options</h2></div></div></div>
      
      <p>Under Windows <span class="application">yabasic</span> will mostly be invoked by double-clicking on an appropriate icon; this way you do not have a chance to specify any of the command line options below. However, advanced users may change the librarypath in the registry, which has the same effect as specifying it as an option on the command line.</p>
      <p>See <a class="link" href="#chapter_options" title="Chapter&#160;4.&#160;Command line options of yabasic">the chapter on options</a> for a complete list of all options, either on Unix or Windows.</p>
    </section>

    <section class="section" id="id1342"><div class="titlepage"><div><div><h2 class="title" style="clear: both">The context Menu</h2></div></div></div>
      
      <p>Like every other icon under Windows, the icon of every <span class="application">yabasic</span>-program has a <span class="emphasis"><em>context menu</em></span> offering the most frequent operations, that may be applied to a <span class="application">yabasic</span>-program.</p>

      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="guilabel">Execute</span></span></dt><dd>
	    <p>This will invoke <span class="application">yabasic</span> to execute your program. The same happens, if you <span class="emphasis"><em>double click</em></span> on the icon.</p>
	  </dd><dt><span class="term"><span class="guilabel">Edit</span></span></dt><dd>
	    <p><span class="application">notepad</span> will be invoked, allowing you to edit your program.</p>
	  </dd><dt><span class="term"><span class="guilabel">View docu</span></span></dt><dd>
	    <p>This will present the embedded documentation of your program. Embedded documentation is created with the special comment <code class="function"><a class="link" href="#ref_doc" title="doc">doc</a></code>.</p>
	  </dd></dl></div>
    </section>
  </section>



  <section class="chapter" id="chapter_program_unix"><div class="titlepage"><div><div><h1 class="title">Chapter&#160;3.&#160;The <span class="application">yabasic</span>-program under Unix</h1></div></div></div><div class="toc"><ul class="toc"><li><span class="section"><a href="#id1343">Starting <span class="application">yabasic</span></a></span></li><li><span class="section"><a href="#id1344">Options</a></span></li><li><span class="section"><a href="#id1345">Setting defaults</a></span></li></ul></div>
    
    <section class="section" id="id1343"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Starting <span class="application">yabasic</span></h2></div></div></div>
      
      <p>If your system administrator (vulgo <span class="emphasis"><em>root</em></span>) has installed <span class="application">yabasic</span> correctly, there are three ways to start it:</p>

      <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
	  <p>You may use your favorite editor (<span class="application">emacs</span>, <span class="application">vi</span> ?) to put your program into a file (e.g. <code class="filename">foo</code>). Make sure that the very first line starts with the characters '<code class="literal">#!</code>'  followed by the full pathname of <span class="application">yabasic</span> (e.g. '<code class="literal">#!/usr/local/bin/yabasic</code>'). This <span class="emphasis"><em>she-bang</em></span>-line ensures, that your Unix will invoke <span class="application">yabasic</span> to execute your program (see also the entry for the <a class="link" href="#ref_hash" title="#">hash</a>-character). Moreover, you will need to change the permissions of your <span class="application">yabasic</span>-program <code class="filename">foo</code>, e.g. <code class="literal">chmod u+x foo</code>. After that you may invoke <span class="application">yabasic</span> to invoke your program by simply typing <code class="literal">foo</code> (without even mentioning <span class="application">yabasic</span>). However, if your <code class="envar">PATH</code>-variable does not contain a single dot ('<code class="literal">.</code>') you will have to type the full pathname of your program: e.g. <code class="filename">/home/ihm/foo</code> (or at least <code class="filename">./foo</code>).</p>
	</li><li class="listitem">
	  <p>Save your program into a file (e.g. <code class="filename">foo</code>) and type <code class="literal">yabasic foo</code>. This assumes, that the directory, where <span class="application">yabasic</span> resides, is contained within your <code class="envar">PATH</code>-variable.</p>
	</li><li class="listitem">
	  <p>Finally your may simply type <strong class="userinput"><code>yabasic</code></strong> (maybe it will be necessary to include its full pathname). This will make <span class="application">yabasic</span> come up and you will be asked to type in your program. Once you are finished, you need to type <code class="literal">return</code> twice, and <span class="application">yabasic</span> will parse and execute your program.</p>
	  <div class="note"><h3 class="title">Note</h3>
	    <p>This is <span class="emphasis"><em>not</em></span> the preferred way of starting <span class="application">yabasic</span> ! Simply because the program, that you have typed, <span class="emphasis"><em>can not be saved</em></span> and will be lost inevitably ! There is no such thing as a <code class="function">save</code>-command and therefore no way to conserve the program, that you have typed. This mode is only intended for quick hacks, and short programs, i.e. for using <span class="application">yabasic</span> as some sort of fancy desktop calculator.</p>
	  </div>
	</li></ol></div>
    </section>

    <section class="section" id="id1344"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Options</h2></div></div></div>
      
      <p><span class="application">yabasic</span> accepts a number of options on the command line.</p>
      <p>See <a class="link" href="#chapter_options" title="Chapter&#160;4.&#160;Command line options of yabasic">chapter on options</a> for a complete list of all options, either on Unix or Windows.</p>
    </section>

    <section class="section" id="id1345"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Setting defaults</h2></div></div></div>
      
      <p>If you want to set some options <span class="emphasis"><em>once for all</em></span>, you may put them into your X-Windows resource file. This is usually the file <code class="filename">.Xresources</code> or some such within your home directory (type <strong class="userinput"><code>man X</code></strong> for details).</p>
      <p>Here is a sample section, which may appear within this file:</p>
      <pre class="programlisting">
yabasic*foreground: blue
yabasic*background: gold
yabasic*geometry: +10+10
yabasic*font: 9x15
</pre>
      <p>This will set the foreground color of the graphic-window to <span class="emphasis"><em>blue</em></span> and the background color to <span class="emphasis"><em>gold</em></span>. The window will appear at position <span class="emphasis"><em>10,10</em></span> and the text font will be <span class="emphasis"><em>9x15</em></span>.</p>
    </section>
  </section>


  <section class="chapter" id="chapter_options"><div class="titlepage"><div><div><h1 class="title">Chapter&#160;4.&#160;Command line options of <span class="application">yabasic</span></h1></div></div></div>
    
    <p>Here are the options, that <span class="application">yabasic</span> accepts on the command line (both under Unix and Windows).</p>
    <p>All the options below may be abbreviated (and one hyphen may be dropped), as long as the abbreviation does not become ambiguous. For example, you may write <code class="literal">-e</code> instead of <code class="literal">--execute</code>.</p>
      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">--help</code> or <code class="literal">-?</code></span></dt><dd>
	    <p>Prints a short help message, which itself describes two further help-options.</p>
	  </dd><dt><span class="term"><code class="literal">--version</code></span></dt><dd>
	    <p>Prints the version of <span class="application">yabasic</span>.</p>
	  </dd><dt><span class="term"><code class="literal">--infolevel <em class="replaceable"><code>INFOLEVEL</code></em></code></span></dt><dd>
	    <p>Change the <span class="emphasis"><em>infolevel</em></span> of yabasic, where <em class="replaceable"><code>INFOLEVEL</code></em> can be one of <code class="literal">debug</code>, <code class="literal">note</code>, <code class="literal">warning</code>, <code class="literal">error</code>, <code class="literal">fatal</code> and <code class="literal">bison</code> (the default is <code class="literal">warning</code>). This option changes the amount of debugging-information <span class="application">yabasic</span> produces. However, normally only the author of <span class="application">yabasic</span> would want to change this.</p>
	  </dd><dt><span class="term"><code class="literal">--execute <em class="replaceable"><code>A-PROGRAM-AS-A-SINGLE-STRING</code></em></code></span></dt><dd>
	    <p>With this option you may specify some <span class="application">yabasic</span>-code to be executed <span class="emphasis"><em>right away</em></span>. This is useful for very short programs, which you do not want to save to a file. If this option is given, <span class="application">yabasic</span> will not read any code from a file. E.g. </p><pre class="programlisting">yabasic -e 'for a=1 to 10:print a*a:next a'</pre><p> prints the square numbers from 1 to 10.
</p>
	  </dd><dt><span class="term"><code class="literal">--bind <em class="replaceable"><code>NAME-OF-STANDALONE-PROGRAM</code></em></code></span></dt><dd>
	    <p>Create a standalone program (whose name is specified by <em class="replaceable"><code>NAME-OF-STANDALONE-PROGRAM</code></em>) from the <span class="application">yabasic</span>-program, that is specified on the command line. See the section about <a class="link" href="#ref_standalone" title="Creating a standalone program from your yabasic-program">creating a <span class="emphasis"><em>standalone</em></span>-program</a> for details.</p>
	  </dd><dt><span class="term"><code class="literal">--geometry +<em class="replaceable"><code>X-POSITION</code></em>+<em class="replaceable"><code>Y-POSITION</code></em></code></span></dt><dd>
	    <p>Sets the position of the graphic window, that is opened by <code class="function">open window</code> (the <span class="emphasis"><em>size</em></span> of this window, of course, is specified within the <code class="function">open window</code>-command). An example would be <code class="literal">-geometry +20+10</code>, which would place the graphic window 10 pixels below the upper border and 20 pixels right of the left border of the screen. This value cannot be changed, once <span class="application">yabasic</span> has been started.</p>
	  </dd><dt><span class="term"><code class="literal">-fg <em class="replaceable"><code>FOREGROUND-COLOR</code></em></code> or <code class="literal">--foreground <em class="replaceable"><code>FOREGROUND-COLOR</code></em></code></span></dt><dd>
	    <p><span class="emphasis"><em>Unix only.</em></span> Define the foreground color for the graphics-window (that will be opened with <code class="function"><a class="link" href="#ref_open_window" title="open window">open window</a></code>). The usual X11 color names, like <span class="emphasis"><em>red</em></span>, <span class="emphasis"><em>green</em></span>, &#8230; are accepted. This value cannot be changed, once <span class="application">yabasic</span> has been started.</p>
	  </dd><dt><span class="term"><code class="literal">-bg <em class="replaceable"><code>BACKGROUND-COLOR</code></em></code> or <code class="literal">--background <em class="replaceable"><code>BACKGROUND-COLOR</code></em></code></span></dt><dd>
	    <p><span class="emphasis"><em>Unix only.</em></span> Define the background color for the graphics-window. The usual X11 color names are accepted. This value cannot be changed, once <span class="application">yabasic</span> has been started.</p>
	  </dd><dt><span class="term"><code class="literal">--display <em class="replaceable"><code>X11-DISPLAY-SPECIFICATION</code></em></code></span></dt><dd>
	    <p><span class="emphasis"><em>Unix only.</em></span> Specify the <span class="emphasis"><em>display</em></span>, where the graphics window of yabasic should appear. Normally this value will be already present within the environment variable <code class="envar">DISPLAY</code>.</p>
	  </dd><dt><span class="term"><code class="literal">--font <em class="replaceable"><code>NAME-OF-FONT</code></em></code></span></dt><dd>
	    <p><span class="emphasis"><em>Under Unix.</em></span> Name of the font, which will be used for text within the graphics window.</p>
	  </dd><dt><span class="term"><code class="literal">--font <em class="replaceable"><code>NAME-OF-FONT</code></em></code></span></dt><dd>
	    <p><span class="emphasis"><em>Under Windows.</em></span> Name of the font, which will be used for graphic-text; can be any of <code class="literal">decorative, dontcare, modern, roman, script, swiss</code>. You may append a fontsize (measured in pixels) to any of those fontnames; for example <code class="literal">-font swiss30</code> chooses a swiss-type font with a size of 30 pixels.</p>
	  </dd><dt><span class="term"><code class="literal">--docu <em class="replaceable"><code>NAME-OF-A-PROGRAM</code></em></code></span></dt><dd>
	    <p>Print the <span class="emphasis"><em>embedded documentation</em></span> of the named program. The embedded documentation of a program consists of all the comments within the program, which start with the special keyword <code class="function"><a class="link" href="#ref_doc" title="doc">doc</a></code>. This documentation can also be seen by choosing the corresponding entry from the context-menu of any <span class="application">yabasic</span>-program.</p>
	  </dd><dt><span class="term"><code class="literal">--check</code></span></dt><dd>
	    <p>Check for possible compatibility problems within your <span class="application">yabasic</span>-program. E.g. this option reports, if you are using a function, that has recently changed.</p>
	  </dd><dt><span class="term"><code class="literal">--librarypath <em class="replaceable"><code>DIRECTORY-WITH-LIBRARIES</code></em></code></span></dt><dd>
	    <p>Change the directory, wherein libraries will be searched and imported (with the <code class="function"><a class="link" href="#ref_import" title="import">import</a></code>-command). See also <code class="function"><a class="link" href="#ref_import" title="import">import</a></code> for more information about the way, libraries are searched.</p>
	  </dd><dt><span class="term"><code class="literal">--</code></span></dt><dd>
	    <p>Do not try to parse any further options; rather pass the subsequent words from the commandline to <span class="application">yabasic</span>.</p>
	  </dd></dl></div>
  </section>
  

  <section class="chapter" id="chapter_topics_list"><div class="titlepage"><div><div><h1 class="title">Chapter&#160;5.&#160;All commands and functions of <span class="application">yabasic</span> listed by topic</h1></div></div></div><div class="toc"><ul class="toc"><li><span class="section"><a href="#top_numbers_with_base_2_or_16">Numbers with base 2 or 16</a></span></li><li><span class="section"><a href="#top_numbers">Number processing and conversion</a></span></li><li><span class="section"><a href="#top_conditions">Conditions and control structures</a></span></li><li><span class="section"><a href="#top_data">Data keeping and processing</a></span></li><li><span class="section"><a href="#top_strings">String processing</a></span></li><li><span class="section"><a href="#top_io">File operations and printing</a></span></li><li><span class="section"><a href="#top_sub">Subroutines</a></span></li><li><span class="section"><a href="#top_lib">Libraries</a></span></li><li><span class="section"><a href="#top_outside">Invoking other program from within yabasic</a></span></li><li><span class="section"><a href="#top_add_code">Adding new code to a running program</a></span></li><li><span class="section"><a href="#top_time_and_timing">Commands and functions related with time</a></span></li><li><span class="section"><a href="#top_other">Other commands</a></span></li><li><span class="section"><a href="#top_graphics">Graphics and printing</a></span></li><li><span class="section"><a href="#top_ffi">The foreign function interface</a></span></li></ul></div>
    

    <section class="section" id="top_numbers_with_base_2_or_16"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Numbers with base 2 or 16</h2></div></div></div>
      
      <p>In addition to the usual decimal notation (e.g. <code class="literal">1234</code>), <span class="application">yabasic</span> also supports numeric literals with base 2 or 16; examples are <code class="literal">0b10011</code> (the number 19, written with base 2) or <code class="literal">0x34AF</code> (the number 13487, written with base 16) respectively. Please note that these numbers (apart from the way you write them into your program) are no different from <span class="quote">&#8220;<span class="quote">ordinary</span>&#8221;</span> numbers and can be used in any place, where a normal number with base 10 would fit. E.g. you may compute the sine <code class="literal">sin(0b110)</code>; so the base 2 (or 16) is just a different way of <span class="emphasis"><em>representation</em></span>.</p>
      <p>See <code class="function"><a class="link" href="#ref_bin" title="bin$()">bin$</a></code>, <code class="function"><a class="link" href="#ref_hex" title="hex$()">hex$</a></code> or <code class="function"><a class="link" href="#ref_dec" title="dec()">dec</a></code> for related functions.</p>
    </section>

    <section class="section" id="top_numbers"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Number processing and conversion</h2></div></div></div>
      
      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#ref_abs" title="abs()">abs()</a></span></dt><dd>
	    returns the absolute value of its numeric argument
	  </dd><dt><span class="term"><a class="link" href="#ref_acos" title="acos()">acos()</a></span></dt><dd>
	    returns the arcus cosine of its numeric argument
	  </dd><dt><span class="term"><a class="link" href="#ref_bitwise_and" title="and()">and()</a></span></dt><dd>
	    the bitwise arithmetic and
	  </dd><dt><span class="term"><a class="link" href="#ref_asin" title="asin()">asin()</a></span></dt><dd>
	    returns the arcus sine of its numeric argument
	  </dd><dt><span class="term"><a class="link" href="#ref_atan" title="atan()">atan()</a></span></dt><dd>
	    returns the arctangent of its numeric argument
	  </dd><dt><span class="term"><a class="link" href="#ref_bin" title="bin$()">bin$()</a></span></dt><dd>
	    converts a number into a sequence of binary digits
	  </dd><dt><span class="term"><a class="link" href="#ref_cos" title="cos()">cos()</a></span></dt><dd>
	    return the cosine of its single argument
	  </dd><dt><span class="term"><a class="link" href="#ref_dec" title="dec()">dec()</a></span></dt><dd>
	    convert a base 2 or base 16 number into decimal form
	  </dd><dt><span class="term"><a class="link" href="#ref_eor" title="eor()">eor()</a></span></dt><dd>
	    compute the bitwise exclusive or of its two arguments
	  </dd><dt><span class="term"><a class="link" href="#ref_euler" title="euler">euler</a></span></dt><dd>
	    another name for the constant 2.71828182864
	  </dd><dt><span class="term"><a class="link" href="#ref_exp" title="exp()">exp()</a></span></dt><dd>
	    compute the exponential function of its single argument
	  </dd><dt><span class="term"><a class="link" href="#ref_frac" title="frac()">frac()</a></span></dt><dd>
	    return the fractional part of its numeric argument
	  </dd><dt><span class="term"><a class="link" href="#ref_int" title="int()">int()</a></span></dt><dd>
	    return the integer part of its single numeric argument
	  </dd><dt><span class="term"><a class="link" href="#ref_ceil" title="ceil()">ceil()</a></span></dt><dd>
	    compute the ceiling for its (float) argument
	  </dd><dt><span class="term"><a class="link" href="#ref_floor" title="floor()">floor()</a></span></dt><dd>
	    compute the floor for its (float) argument
	  </dd><dt><span class="term"><a class="link" href="#ref_round" title="round()">round()</a></span></dt><dd>
	    round its argument to the nearest integer
	  </dd><dt><span class="term"><a class="link" href="#ref_log" title="log()">log()</a></span></dt><dd>
	    compute the natural logarithm
	  </dd><dt><span class="term"><a class="link" href="#ref_max" title="max()">max()</a></span></dt><dd>
	    return the larger of its two arguments
	  </dd><dt><span class="term"><a class="link" href="#ref_min" title="min()">min()</a></span></dt><dd>
	    return the smaller of its two arguments
	  </dd><dt><span class="term"><a class="link" href="#ref_mod" title="mod">mod</a></span></dt><dd>
	    compute the remainder of a division
	  </dd><dt><span class="term"><a class="link" href="#ref_bitnot" title="bitnot()">bitnot()</a></span></dt><dd>
	    the bitwise arithmetic not
	  </dd><dt><span class="term"><a class="link" href="#ref_bitwise_or" title="or()">or()</a></span></dt><dd>
	    arithmetic or, used for bit-operations
	  </dd><dt><span class="term"><a class="link" href="#ref_pi" title="pi">pi</a></span></dt><dd>
	    a constant with the value 3.14159
	  </dd><dt><span class="term"><a class="link" href="#ref_ran" title="ran()">ran()</a></span></dt><dd>
	    return a random number
	  </dd><dt><span class="term"><a class="link" href="#ref_shl" title="shl()">shl()</a></span></dt><dd>
	    shift its argument bitwise to the left
	  </dd><dt><span class="term"><a class="link" href="#ref_shr" title="shr()">shr()</a></span></dt><dd>
	    shift its argument bitwise to the right
	  </dd><dt><span class="term"><a class="link" href="#ref_sig" title="sig()">sig()</a></span></dt><dd>
	    return the sign of its argument
	  </dd><dt><span class="term"><a class="link" href="#ref_sin" title="sin()">sin()</a></span></dt><dd>
	    return the sine of its single argument
	  </dd><dt><span class="term"><a class="link" href="#ref_sqr" title="sqr()">sqr()</a></span></dt><dd>
	    compute the square of its argument
	  </dd><dt><span class="term"><a class="link" href="#ref_sqrt" title="sqrt()">sqrt()</a></span></dt><dd>
	    compute the square root of its argument
	  </dd><dt><span class="term"><a class="link" href="#ref_tan" title="tan()">tan()</a></span></dt><dd>
	    return the tangent of its argument
	  </dd><dt><span class="term"><a class="link" href="#ref_xor" title="xor()">xor()</a></span></dt><dd>
	    compute the exclusive or
	  </dd><dt><span class="term"><a class="link" href="#ref_pow" title="** or ^">** or ^</a></span></dt><dd>
	    raise its first argument to the power of its second
	  </dd><dt><span class="term"><a class="link" href="#ref_comparison" title="&lt; &lt;= &gt; &gt;= = == &lt;&gt; !=">&lt; &lt;= &gt; &gt;= = == &lt;&gt; !=</a></span></dt><dd>
	    Compare numbers or strings
	  </dd></dl></div>
    </section>

    <section class="section" id="top_conditions"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Conditions and control structures</h2></div></div></div>
      
      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#ref_logical_and" title="and">and</a></span></dt><dd>
	    logical and, used in conditions
	  </dd><dt><span class="term"><a class="link" href="#ref_break" title="break">break</a></span></dt><dd>
	    breaks out of one or more loops or switch statements
	  </dd><dt><span class="term"><a class="link" href="#ref_case" title="case">case</a></span></dt><dd>
	    mark the different cases within a switch-statement
	  </dd><dt><span class="term"><a class="link" href="#ref_continue" title="continue">continue</a></span></dt><dd>
	    start the next iteration of a for-, do-, repeat- or while-loop
	  </dd><dt><span class="term"><a class="link" href="#ref_default" title="default">default</a></span></dt><dd>
	    mark the default-branch within a switch-statement
	  </dd><dt><span class="term"><a class="link" href="#ref_do" title="do">do</a></span></dt><dd>
	    start a (conditionless) do-loop
	  </dd><dt><span class="term"><a class="link" href="#ref_else" title="else">else</a></span></dt><dd>
	    mark an alternative within an if-statement
	  </dd><dt><span class="term"><a class="link" href="#ref_elsif" title="elsif">elsif</a></span></dt><dd>
	    starts an alternate condition within an if-statement
	  </dd><dt><span class="term"><a class="link" href="#ref_end" title="end">end</a></span></dt><dd>
	    terminate your program
	  </dd><dt><span class="term"><a class="link" href="#ref_endif" title="endif">endif</a></span></dt><dd>
	    ends an if-statement
	  </dd><dt><span class="term"><a class="link" href="#ref_false" title="false">false</a></span></dt><dd>
	    a constant with the value of 0
	  </dd><dt><span class="term"><a class="link" href="#ref_fi" title="fi">fi</a></span></dt><dd>
	    another name for endif
	  </dd><dt><span class="term"><a class="link" href="#ref_for" title="for">for</a></span></dt><dd>
	    starts a for-loop
	  </dd><dt><span class="term"><a class="link" href="#ref_gosub" title="gosub">gosub</a></span></dt><dd>
	    continue execution at another point within your program (and return later)
	  </dd><dt><span class="term"><a class="link" href="#ref_goto" title="goto">goto</a></span></dt><dd>
	    continue execution at another point within your program (and never come back)
	  </dd><dt><span class="term"><a class="link" href="#ref_if" title="if">if</a></span></dt><dd>
	    evaluate a condition and execute statements or not, depending on the result
	  </dd><dt><span class="term"><a class="link" href="#ref_label" title="label">label</a></span></dt><dd>
	    mark a specific location within your program for goto, gosub or restore
	  </dd><dt><span class="term"><a class="link" href="#ref_loop" title="loop">loop</a></span></dt><dd>
	    marks the end of an infinite loop
	  </dd><dt><span class="term"><a class="link" href="#ref_next" title="next">next</a></span></dt><dd>
	    mark the end of a for loop
	  </dd><dt><span class="term"><a class="link" href="#ref_logical_not" title="not">not</a></span></dt><dd>
	    negate a logical expression; can be written as !
	  </dd><dt><span class="term"><a class="link" href="#ref_on_gosub" title="on gosub">on gosub</a></span></dt><dd>
	    jump to one of multiple gosub-targets
	  </dd><dt><span class="term"><a class="link" href="#ref_on_goto" title="on goto">on goto</a></span></dt><dd>
	    jump to one of many goto-targets
	  </dd><dt><span class="term"><a class="link" href="#ref_on_interrupt" title="on interrupt">on interrupt</a></span></dt><dd>
	    change reaction on keyboard interrupts
	  </dd><dt><span class="term"><a class="link" href="#ref_logical_or" title="logical or">logical or</a></span></dt><dd>
	    logical or, used in conditions
	  </dd><dt><span class="term"><a class="link" href="#ref_bitwise_or" title="or()">bitwise or</a></span></dt><dd>
	    arithmetic or, used for bit-operations
	  </dd><dt><span class="term"><a class="link" href="#ref_pause" title="pause">pause</a></span></dt><dd>
	    pause, sleep, wait for the specified number of seconds
	  </dd><dt><span class="term"><a class="link" href="#ref_repeat" title="repeat">repeat</a></span></dt><dd>
	    start a repeat-loop
	  </dd><dt><span class="term"><a class="link" href="#ref_return" title="return">return</a></span></dt><dd>
	    return from a subroutine or a gosub
	  </dd><dt><span class="term"><a class="link" href="#ref_sleep" title="sleep">sleep</a></span></dt><dd>
	    pause, sleep, wait for the specified number of seconds
	  </dd><dt><span class="term"><a class="link" href="#ref_step" title="step">step</a></span></dt><dd>
	    specifies the increment step in a for-loop
	  </dd><dt><span class="term"><a class="link" href="#ref_switch" title="switch">switch</a></span></dt><dd>
	    select one of many alternatives depending on a value
	  </dd><dt><span class="term"><a class="link" href="#ref_then" title="then">then</a></span></dt><dd>
	    tell the long from the short form of the if-statement
	  </dd><dt><span class="term"><a class="link" href="#ref_true" title="true">true</a></span></dt><dd>
	    a constant with the value of 1
	  </dd><dt><span class="term"><a class="link" href="#ref_until" title="until">until</a></span></dt><dd>
	    end a repeat-loop
	  </dd><dt><span class="term"><a class="link" href="#ref_wait" title="wait">wait</a></span></dt><dd>
	    pause, sleep, wait for the specified number of seconds
	  </dd><dt><span class="term"><a class="link" href="#ref_wend" title="wend">wend</a></span></dt><dd>
	    end a while-loop
	  </dd><dt><span class="term"><a class="link" href="#ref_while" title="while">while</a></span></dt><dd>
	    start a while-loop
	  </dd><dt><span class="term"><a class="link" href="#ref_colon" title=":">:</a></span></dt><dd>
	    separate commands from each other
	  </dd></dl></div>
    </section>

    <section class="section" id="top_data"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Data keeping and processing</h2></div></div></div>
      
      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#ref_arraydim" title="arraydim()">arraydim()</a></span></dt><dd>
	    returns the dimension of the array, which is passed as an array reference
	  </dd><dt><span class="term"><a class="link" href="#ref_arraysize" title="arraysize()">arraysize()</a></span></dt><dd>
	    returns the size of a dimension of an array
	  </dd><dt><span class="term"><a class="link" href="#ref_data" title="data">data</a></span></dt><dd>
	    introduces a list of data-items
	  </dd><dt><span class="term"><a class="link" href="#ref_dim" title="dim">dim</a></span></dt><dd>
	    create an array prior to its first use
	  </dd><dt><span class="term"><a class="link" href="#ref_read" title="read">read</a></span></dt><dd>
	    read data from data-statements
	  </dd><dt><span class="term"><a class="link" href="#ref_redim" title="redim">redim</a></span></dt><dd>
	    create an array prior to its first use. A synonym for dim
	  </dd><dt><span class="term"><a class="link" href="#ref_restore" title="restore">restore</a></span></dt><dd>
	    reposition the data-pointer
	  </dd></dl></div>
    </section>

    <section class="section" id="top_strings"><div class="titlepage"><div><div><h2 class="title" style="clear: both">String processing</h2></div></div></div>
      
      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#ref_asc" title="asc()">asc()</a></span></dt><dd>
	    accepts a string and returns the position of its first character within the ascii charset
	  </dd><dt><span class="term"><a class="link" href="#ref_chomp" title="chomp$()">chomp$()</a></span></dt><dd>
	    remove a single trailing newline from its string-argument; if the string does not end in a newline, the string is returned unchanged
	  </dd><dt><span class="term"><a class="link" href="#ref_chr" title="chr$()">chr$()</a></span></dt><dd>
	    accepts a number and returns the character at this position within the ascii charset
	  </dd><dt><span class="term"><a class="link" href="#ref_glob" title="glob()">glob()</a></span></dt><dd>
	    check if a string matches a simple pattern
	  </dd><dt><span class="term"><a class="link" href="#ref_hex" title="hex$()">hex$()</a></span></dt><dd>
	    convert a number into hexadecimal
	  </dd><dt><span class="term"><a class="link" href="#ref_instr" title="instr()">instr()</a></span></dt><dd>
	    searches its second argument within the first; returns its position if found
	  </dd><dt><span class="term"><a class="link" href="#ref_rinstr" title="rinstr()">rinstr()</a></span></dt><dd>
	    find the rightmost occurrence of one string within the other
	  </dd><dt><span class="term"><a class="link" href="#ref_left" title="left$()">left$()</a></span></dt><dd>
	    return (or change) left end of a string
	  </dd><dt><span class="term"><a class="link" href="#ref_len" title="len()">len()</a></span></dt><dd>
	    return the length of a string
	  </dd><dt><span class="term"><a class="link" href="#ref_lower" title="lower$()">lower$()</a></span></dt><dd>
	    convert a string to lower case
	  </dd><dt><span class="term"><a class="link" href="#ref_ltrim" title="ltrim$()">ltrim$()</a></span></dt><dd>
	    trim spaces at the left end of a string
	  </dd><dt><span class="term"><a class="link" href="#ref_mid" title="mid$()">mid$()</a></span></dt><dd>
	    return (or change) characters from within a string
	  </dd><dt><span class="term"><a class="link" href="#ref_right" title="right$()">right$()</a></span></dt><dd>
	    return (or change) the right end of a string
	  </dd><dt><span class="term"><a class="link" href="#ref_split" title="split()">split()</a></span></dt><dd>
	    split a string into many strings
	  </dd><dt><span class="term"><a class="link" href="#ref_str" title="str$()">str$()</a></span></dt><dd>
	    convert a number into a string
	  </dd><dt><span class="term"><a class="link" href="#ref_string" title="string$()">string$()</a></span></dt><dd>
	    create a new string by repeating the given one a certain number of times
	  </dd><dt><span class="term"><a class="link" href="#ref_token" title="token()">token()</a></span></dt><dd>
	    split a string into multiple strings
	  </dd><dt><span class="term"><a class="link" href="#ref_trim" title="trim$()">trim$()</a></span></dt><dd>
	    remove leading and trailing spaces from its argument
	  </dd><dt><span class="term"><a class="link" href="#ref_rtrim" title="rtrim$()">rtrim$()</a></span></dt><dd>
	    trim spaces at the right end of a string
	  </dd><dt><span class="term"><a class="link" href="#ref_upper" title="upper$()">upper$()</a></span></dt><dd>
	    convert a string to upper case
	  </dd><dt><span class="term"><a class="link" href="#ref_val" title="val()">val()</a></span></dt><dd>
	    converts a string to a number
	  </dd></dl></div>
    </section>

    <section class="section" id="top_io"><div class="titlepage"><div><div><h2 class="title" style="clear: both">File operations and printing</h2></div></div></div>
      
      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#ref_at" title="at()">at()</a></span></dt><dd>
	    can be used in the commands print and input to place the output at a specified position
	  </dd><dt><span class="term"><a class="link" href="#ref_beep" title="beep">beep</a></span></dt><dd>
	    ring the bell within your computer; a synonym for bell
	  </dd><dt><span class="term"><a class="link" href="#ref_bell" title="bell">bell</a></span></dt><dd>
	    ring the bell within your computer (just as beep)
	  </dd><dt><span class="term"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></span></dt><dd>
	    erases the text window
	  </dd><dt><span class="term"><a class="link" href="#ref_close" title="close">close</a></span></dt><dd>
	    close a file, which has been opened before
	  </dd><dt><span class="term"><a class="link" href="#ref_close_printer" title="close printer">close printer</a></span></dt><dd>
	    stops printing of graphics
	  </dd><dt><span class="term"><a class="link" href="#ref_print_color" title="print or input with color">print color</a></span></dt><dd>
	    print or input-prompt with color
	  </dd><dt><span class="term"><a class="link" href="#ref_print_colour" title="print colour">print colour</a></span></dt><dd>
	    see print color
	  </dd><dt><span class="term"><a class="link" href="#ref_eof" title="eof">eof</a></span></dt><dd>
	    check, if an open file contains data
	  </dd><dt><span class="term"><a class="link" href="#ref_getscreen" title="getscreen$()">getscreen$()</a></span></dt><dd>
	    returns a string representing a rectangular section of the text terminal
	  </dd><dt><span class="term"><a class="link" href="#ref_inkey" title="inkey$">inkey$</a></span></dt><dd>
	    wait, until a key is pressed
	  </dd><dt><span class="term"><a class="link" href="#ref_input" title="input">input</a></span></dt><dd>
	    read input from user or  file and assign it to a variable
	  </dd><dt><span class="term"><a class="link" href="#ref_line_input" title="line input">line input</a></span></dt><dd>
	    read in a whole line of text and assign it to a variable
	  </dd><dt><span class="term"><a class="link" href="#ref_open" title="open">open</a></span></dt><dd>
	    open a file
	  </dd><dt><span class="term"><a class="link" href="#ref_open_printer" title="open printer">open printer</a></span></dt><dd>
	    open printer for printing graphics
	  </dd><dt><span class="term"><a class="link" href="#ref_print" title="print">print</a></span></dt><dd>
	    Write to terminal or file
	  </dd><dt><span class="term"><a class="link" href="#ref_putscreen" title="putscreen">putscreen</a></span></dt><dd>
	    draw a rectangle of characters into the text terminal
	  </dd><dt><span class="term"><a class="link" href="#ref_reverse" title="reverse">reverse</a></span></dt><dd>
	    print reverse (background and foreground colors exchanged)
	  </dd><dt><span class="term"><a class="link" href="#ref_screen" title="screen">screen</a></span></dt><dd>
	    as clear screen clears the text window
	  </dd><dt><span class="term"><a class="link" href="#ref_seek" title="seek()">seek()</a></span></dt><dd>
	    change the position within an open file
	  </dd><dt><span class="term"><a class="link" href="#ref_tell" title="tell">tell</a></span></dt><dd>
	    get the current position within an open file
	  </dd><dt><span class="term"><a class="link" href="#ref_using" title="using">using</a></span></dt><dd>
	    Specify the format for printing a number
	  </dd><dt><span class="term"><a class="link" href="#ref_hash" title="#">#</a></span></dt><dd>
	    either a comment or a marker for a file-number
	  </dd><dt><span class="term"><a class="link" href="#ref_at" title="at()">at</a></span></dt><dd>
	    can be used in the commands print and input to place the output at a specified position
	  </dd><dt><span class="term"><a class="link" href="#ref_at_sign" title="@">@</a></span></dt><dd>
	    synonymous to at
	  </dd><dt><span class="term"><a class="link" href="#ref_semicolon" title=";">;</a></span></dt><dd>
	    suppress the implicit newline after a print-statement
	  </dd></dl></div>
    </section>

    <section class="section" id="top_sub"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Subroutines</h2></div></div></div>
      
      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#ref_end_sub" title="end sub">end sub</a></span></dt><dd>
	    ends a subroutine definition
	  </dd><dt><span class="term"><a class="link" href="#ref_local" title="local">local</a></span></dt><dd>
	    mark a variable as local to a subroutine
	  </dd><dt><span class="term"><a class="link" href="#ref_numparams" title="numparams">numparams</a></span></dt><dd>
	    return the number of parameters, that have been passed to a subroutine
	  </dd><dt><span class="term"><a class="link" href="#ref_return" title="return">return</a></span></dt><dd>
	    return from a subroutine or a gosub
	  </dd><dt><span class="term"><a class="link" href="#ref_static" title="static">static</a></span></dt><dd>
	    preserves the value of a variable between calls to a subroutine
	  </dd><dt><span class="term"><a class="link" href="#ref_sub" title="sub">sub</a></span></dt><dd>
	    declare a user defined subroutine
	  </dd></dl></div>
    </section>

    <section class="section" id="top_lib"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Libraries</h2></div></div></div>
      
      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#ref_export" title="export">export</a></span></dt><dd>
	    mark a function as globally visible
	  </dd><dt><span class="term"><a class="link" href="#ref_import" title="import">import</a></span></dt><dd>
	    import a library
	  </dd></dl></div>
    </section>

    <section class="section" id="top_outside"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Invoking other program from within yabasic</h2></div></div></div>
      
      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#ref_system" title="system()">system()</a></span></dt><dd>
	    hand the name of an external command over to your operating system and return its exitcode
	  </dd><dt><span class="term"><a class="link" href="#ref_system2" title="system$()">system$()</a></span></dt><dd>
	    hand the name of an external command over to your operating system and return its output
	  </dd></dl></div>
    </section>


    <section class="section" id="top_add_code"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Adding new code to a running program</h2></div></div></div>
      
      <p>See also <a class="link" href="#ref_add_code" title="Adding code to a running program">adding code during execution</a>.</p>
      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#ref_compile" title="compile">compile</a></span></dt><dd>
	    compile a string with yabasic-code on the fly
	  </dd><dt><span class="term"><a class="link" href="#ref_eval" title="eval()">eval()</a></span></dt><dd>
	    compile and execute a single numeric expression
	  </dd><dt><span class="term"><a class="link" href="#ref_eval2" title="eval$()">eval$()</a></span></dt><dd>
	    compile and execute a single string-expression
	  </dd><dt><span class="term"><a class="link" href="#ref_execute" title="execute()">execute()</a></span></dt><dd>
	    execute a user defined subroutine, which must return a number
	  </dd><dt><span class="term"><a class="link" href="#ref_execute2" title="execute$()">execute$()</a></span></dt><dd>
	    execute a user defined subroutine, which must return a string
	  </dd></dl></div>
    </section>
    
    <section class="section" id="top_time_and_timing"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Commands and functions related with time</h2></div></div></div>
      
      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#ref_date" title="date$">date$</a></span></dt><dd>
	    returns a string with various components of the current date
	  </dd><dt><span class="term"><a class="link" href="#ref_pause" title="pause">pause</a></span></dt><dd>
	    pause, sleep, wait for the specified number of seconds
	  </dd><dt><span class="term"><a class="link" href="#ref_sleep" title="sleep">sleep</a></span></dt><dd>
	    pause, sleep, wait for the specified number of seconds
	  </dd><dt><span class="term"><a class="link" href="#ref_time" title="time$">time$</a></span></dt><dd>
	    return a string containing the current time
	  </dd></dl></div>
    </section>
    
    <section class="section" id="top_other"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Other commands</h2></div></div></div>
      
      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#ref_bind" title="bind()">bind()</a></span></dt><dd>
	    binds a yabasic-program and the yabasic-interpreter together into a standalone program
	  </dd><dt><span class="term"><a class="link" href="#ref_doc" title="doc">doc</a></span></dt><dd>
	    special comment, which might be retrieved by the program itself
	  </dd><dt><span class="term"><a class="link" href="#ref_docu" title="docu$">docu$</a></span></dt><dd>
	    special array, containing the contents of all docu-statement within the program
	  </dd><dt><span class="term"><a class="link" href="#ref_error" title="error">error</a></span></dt><dd>
	    raise an error and terminate your program
	  </dd><dt><span class="term"><a class="link" href="#ref_exit" title="exit">exit</a></span></dt><dd>
	    terminate your program
	  </dd><dt><span class="term"><a class="link" href="#ref_peek" title="peek">peek</a></span></dt><dd>
	    retrieve various internal informations (numeric)
	  </dd><dt><span class="term"><a class="link" href="#ref_peek2" title="peek$">peek$</a></span></dt><dd>
	    retrieve various internal informations (strings)
	  </dd><dt><span class="term"><a class="link" href="#ref_poke" title="poke">poke</a></span></dt><dd>
	    change selected internals of yabasic
	  </dd><dt><span class="term"><a class="link" href="#ref_rem" title="rem">rem</a></span></dt><dd>
	    start a comment
	  </dd><dt><span class="term"><a class="link" href="#ref_to" title="to">to</a></span></dt><dd>
	    this keyword appears as part of other statements
	  </dd><dt><span class="term"><a class="link" href="#ref_wait" title="wait">wait</a></span></dt><dd>
	    pause, sleep, wait for the specified number of seconds
	  </dd><dt><span class="term"><a class="link" href="#ref_double_slash" title="//">//</a></span></dt><dd>
	    starts a comment
	  </dd><dt><span class="term"><a class="link" href="#ref_colon" title=":">:</a></span></dt><dd>
	    separate commands from each other
	  </dd></dl></div>
    </section>

    <section class="section" id="top_graphics"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Graphics and printing</h2></div></div></div>
      
      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#ref_backcolor" title="backcolor">backcolor</a></span></dt><dd>
	    change color for background of graphic window
	  </dd><dt><span class="term"><a class="link" href="#ref_box" title="box">box</a></span></dt><dd>
	    draw a rectangle. A synonym for rectangle
	  </dd><dt><span class="term"><a class="link" href="#ref_circle" title="circle">circle</a></span></dt><dd>
	    draws a circle in the graphic-window
	  </dd><dt><span class="term"><a class="link" href="#ref_clear" title="clear">clear</a></span></dt><dd>
	    erase circles, rectangles or triangles
	  </dd><dt><span class="term"><a class="link" href="#ref_clear_window" title="clear window">clear window</a></span></dt><dd>
	    clear the graphic window and begin a new page, if printing is under way
	  </dd><dt><span class="term"><a class="link" href="#ref_close_curve" title="close curve">close curve</a></span></dt><dd>
	    close a curve, that has been drawn by the line-command
	  </dd><dt><span class="term"><a class="link" href="#ref_close_window" title="close window">close window</a></span></dt><dd>
	    close the graphics-window
	  </dd><dt><span class="term"><a class="link" href="#ref_backcolor" title="backcolor">color</a></span></dt><dd>
	    change color for any subsequent drawing-command
	  </dd><dt><span class="term"><a class="link" href="#ref_dot" title="dot">dot</a></span></dt><dd>
	    draw a dot in the graphic-window
	  </dd><dt><span class="term"><a class="link" href="#ref_fill" title="fill">fill</a></span></dt><dd>
	    draw a filled circles, rectangles or triangles
	  </dd><dt><span class="term"><a class="link" href="#ref_getbit" title="getbit$()">getbit$()</a></span></dt><dd>
	    return a string representing the bit pattern of a rectangle within the graphic window
	  </dd><dt><span class="term"><a class="link" href="#ref_line" title="line">line</a></span></dt><dd>
	    draw a line
	  </dd><dt><span class="term"><a class="link" href="#ref_mouseb" title="mouseb">mouseb</a></span></dt><dd>
	    extract the state of the mousebuttons from a string returned by inkey$
	  </dd><dt><span class="term"><a class="link" href="#ref_mousemod" title="mousemod">mousemod</a></span></dt><dd>
	    return the state of the modifier keys during a mouseclick
	  </dd><dt><span class="term"><a class="link" href="#ref_mousex" title="mousex">mousex</a></span></dt><dd>
	    return the x-position of a mouseclick
	  </dd><dt><span class="term"><a class="link" href="#ref_mousey" title="mousey">mousey</a></span></dt><dd>
	    return the y-position of a mouseclick
	  </dd><dt><span class="term"><a class="link" href="#ref_new_curve" title="new curve">new curve</a></span></dt><dd>
	    start a new curve, that will be drawn with the line-command
	  </dd><dt><span class="term"><a class="link" href="#ref_open_window" title="open window">open window</a></span></dt><dd>
	    open a graphic window
	  </dd><dt><span class="term"><a class="link" href="#ref_putbit" title="putbit">putbit</a></span></dt><dd>
	    draw a rectangle of pixels encoded within a string into the graphics window
	  </dd><dt><span class="term"><a class="link" href="#ref_rectangle" title="rectangle">rectangle</a></span></dt><dd>
	    draw a rectangle
	  </dd><dt><span class="term"><a class="link" href="#ref_triangle" title="triangle">triangle</a></span></dt><dd>
	    draw a triangle
	  </dd><dt><span class="term"><a class="link" href="#ref_text" title="text">text</a></span></dt><dd>
	    write text into your graphic-window
	  </dd><dt><span class="term"><a class="link" href="#ref_origin" title="window origin">window origin</a></span></dt><dd>
	    move the origin of a window

	  </dd></dl></div>
    </section>

    <section class="section" id="top_ffi"><div class="titlepage"><div><div><h2 class="title" style="clear: both">The foreign function interface</h2></div></div></div>
      
      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><a class="link" href="#ref_foreign_buffer_alloc" title="foreign_buffer_alloc$()">foreign_buffer_alloc$()</a></span></dt><dd>
	    Create a new buffer for use in a foreign function call
	  </dd><dt><span class="term"><a class="link" href="#ref_foreign_buffer_dump" title="foreign_buffer_dump$()">foreign_buffer_dump$()</a></span></dt><dd>
	    return the content of a buffer as a hex-encoded string
	  </dd><dt><span class="term"><a class="link" href="#ref_foreign_buffer_free" title="foreign_buffer_free">foreign_buffer_free()</a></span></dt><dd>
	    free a foreign buffer
	  </dd><dt><span class="term"><a class="link" href="#ref_foreign_buffer_get" title="foreign_buffer_get()">foreign_buffer_get()</a></span></dt><dd>
	    extract a number from a foreign buffer
	  </dd><dt><span class="term"><a class="link" href="#ref_foreign_buffer_get2" title="foreign_buffer_get$()">foreign_buffer_get$()</a></span></dt><dd>
	    extract a string from a foreign buffer
	  </dd><dt><span class="term"><a class="link" href="#ref_foreign_buffer_get_buffer" title="foreign_buffer_get_buffer$()">foreign_buffer_get_buffer$()</a></span></dt><dd>
	    take a buffer and construct a handle to a second buffer from its content
	  </dd><dt><span class="term"><a class="link" href="#ref_foreign_buffer_set" title="foreign_buffer_set">foreign_buffer_set</a></span></dt><dd>
	    store a given value within a buffer
	  </dd><dt><span class="term"><a class="link" href="#ref_foreign_buffer_set_buffer" title="foreign_buffer_set_buffer">foreign_buffer_set_buffer</a></span></dt><dd>
	    store a pointer to one buffer within another buffer
	  </dd><dt><span class="term"><a class="link" href="#ref_foreign_buffer_size" title="foreign_buffer_size()">foreign_buffer_size()</a></span></dt><dd>
	    return the size of the foreign buffer
	  </dd><dt><span class="term"><a class="link" href="#ref_foreign_function_call" title="foreign_function_call()">foreign_function_call()</a></span></dt><dd>
	    call a function (returning a number) from a non-yabasic library or dll
	  </dd><dt><span class="term"><a class="link" href="#ref_foreign_function_call2" title="foreign_function_call$()">foreign_function_call$()</a></span></dt><dd>
	    call a function (returning a string or a buffer) from a non-yabasic library or dll
	  </dd><dt><span class="term"><a class="link" href="#ref_frn" title="frnbf_ and frnfn_">foreign_function_size()</a></span></dt><dd>
	    Abbreviations for foreign_buffer_ and foreign_function_
	  </dd><dt><span class="term"><a class="link" href="#ref_foreign_function_size" title="foreign_function_size()">frnbf_ and frnfn_</a></span></dt><dd>
	    return the size of one of the types available for foreign function calls
	  </dd></dl></div>
    </section>

  </section>

    <section class="chapter" id="chapter_ref_concepts"><div class="titlepage"><div><div><h1 class="title">Chapter&#160;6.&#160;Some features and general concepts of <span class="application">yabasic</span></h1></div></div></div><div class="toc"><ul class="toc"><li><span class="section"><a href="#ref_logical_shortcuts">Logical shortcuts</a></span></li><li><span class="section"><a href="#ref_conditions_and_expressions">Conditions and expressions</a></span></li><li><span class="section"><a href="#ref_comparing_strings_or_numbers">Comparing strings or numbers</a></span></li><li><span class="section"><a href="#ref_array_references">References on arrays</a></span><ul><li><span class="section"><a href="#id1346">An example</a></span></li></ul></li><li><span class="section"><a href="#ref_windows_filenames">Specifying Filenames under Windows</a></span></li><li><span class="section"><a href="#ref_escape_sequences">Escape-sequences</a></span></li><li><span class="section"><a href="#ref_subroutines">Subroutines: Sharing code within one program</a></span><ul><li><span class="section"><a href="#id1347">Purpose</a></span></li><li><span class="section"><a href="#id1348">A simple example</a></span></li><li><span class="section"><a href="#id1349">See also</a></span></li></ul></li><li><span class="section"><a href="#ref_libraries">Libraries: Sharing code between many programs</a></span><ul><li><span class="section"><a href="#id1350">Purpose</a></span></li><li><span class="section"><a href="#id1351">A simple example</a></span></li><li><span class="section"><a href="#id1352">Namespaces</a></span></li><li><span class="section"><a href="#id1353">See also</a></span></li></ul></li><li><span class="section"><a href="#ref_add_code">Adding code to a running program</a></span><ul><li><span class="section"><a href="#id1354">Purpose</a></span></li><li><span class="section"><a href="#id1355">How the various functions and commands differ</a></span></li></ul></li><li><span class="section"><a href="#ref_standalone">Creating a <span class="emphasis"><em>standalone</em></span> program from your yabasic-program</a></span><ul><li><span class="section"><a href="#id1356">Creating a standalone-program from the command line</a></span></li><li><span class="section"><a href="#id1357">Creating a standalone-program from within your program</a></span></li><li><span class="section"><a href="#id1358">Points to consider before creating a standalone program</a></span></li><li><span class="section"><a href="#id1359">See also</a></span></li></ul></li><li><span class="section"><a href="#ffi">Interaction with functions from a non-<span class="application">yabasic</span> library or dll</a></span><ul><li><span class="section"><a href="#background_ffi">Some Background</a></span><ul><li><span class="section"><a href="#id1360">Libraries</a></span></li><li><span class="section"><a href="#id1361">Types</a></span></li></ul></li><li><span class="section"><a href="#id1365">Three simple examples</a></span><ul><li><span class="section"><a href="#id1362">Computing the cosine</a></span></li><li><span class="section"><a href="#id1363">Searching a string within another string</a></span></li><li><span class="section"><a href="#id1364">Showing a message box under Windows</a></span></li></ul></li><li><span class="section"><a href="#steps_during_foreign_call">Internal steps during a call to a foreign function</a></span></li><li><span class="section"><a href="#id1366">Abbreviations for long names</a></span></li><li><span class="section"><a href="#structures_and_buffers">Structurs and buffers</a></span></li><li><span class="section"><a href="#id1368">Two more complex examples</a></span><ul><li><span class="section"><a href="#id1367">Dealing with time</a></span></li><li><span class="section"><a href="#example_libcurl">Getting the version of <span class="application">libcurl</span></a></span></li></ul></li><li><span class="section"><a href="#id1369">See also</a></span></li></ul></li></ul></div>
    
    <p>This chapter presents some general concepts and terms, which deserve a description on their own, but are not associated with a single command or function in <span class="application">yabasic</span>. Most of these topics do not lend themselves to be read alone, rather they might be read (or skimmed) as background material if an entry from the <a class="link" href="#chapter_ref_words" title="Chapter&#160;7.&#160;All commands and functions of yabasic grouped alphabetically">alphabetical list of commands</a> refers to them.</p>
    <section class="section" id="ref_logical_shortcuts"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Logical shortcuts</h2></div></div></div>
      
      <p><span class="emphasis"><em>Logical shortcuts</em></span> are no special language construct and there is no keyword for them; they are just a way to evaluate <span class="emphasis"><em>logical expressions</em></span>. Logical expressions (i.e. a series of conditions or comparisons joined by <a class="link" href="#ref_bitwise_and" title="and()"><code class="function">and</code></a> or <a class="link" href="#ref_bitwise_or" title="or()"><code class="function">or</code></a>) are only evaluated until the final result of the expression can be determined. An example:</p>
      <div class="informalexample">
	<pre class="programlisting">
if (a&lt;&gt;0 and b/a&gt;2) print "b is at least twice as big as a"
</pre>
      </div>
      <p>
      The logical expression <code class="literal">a&lt;&gt;0 and b/a&gt;2</code> consists of two comparisons, both of which must be true, if the <code class="function">print</code> statement should be executed. Now, if the first comparison (<code class="literal">a&lt;&gt;0</code>) is <code class="constant">false</code>, the whole logical expression can never be <code class="constant">true</code> and the second comparison (<code class="literal">b/a&gt;2</code>) need not be evaluated.
      </p>
      <p>This is exactly, how <span class="application">yabasic</span> behaves: The evaluation of a composed logical expressions is terminated immediately, as soon as the final result can be deduced from the already evaluated parts.</p>
      <p>In practice, this has the following consequences:</p>
      <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	  <p>If two or more comparisons are joined with <code class="function">and</code> and one comparison results in <code class="constant">false</code>, the logical expression is evaluated no further and the overall result is <code class="constant">false</code>.</p>
	</li><li class="listitem">
	  <p>If two or more comparisons are joined with <code class="function">or</code> and one comparison results in <code class="constant">true</code>, the logical expression is evaluated no further and the result is <code class="constant">true</code>.</p>
	</li></ul></div>
      <p><span class="quote">&#8220;<span class="quote">Nice, but whats this good for ?</span>&#8221;</span>, I hear you say. Well, just have another look at the example, especially the second comparison (<code class="literal">b/a&gt;2</code>); dividing <code class="literal">b</code> by <code class="literal">a</code> is potentially hazardous: If <code class="literal">a</code> equals zero, the expression will cause an error and your program will terminate. To avoid this, the first part of the comparison (<code class="literal">a&lt;&gt;0</code>) checks, if the second one can be evaluated without risk. This pre-checking is the most common usage and primary motivation for <span class="emphasis"><em>logical shortcuts</em></span> (and the reason why most programming languages implement them).</p>
    </section>

    <section class="section" id="ref_conditions_and_expressions"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Conditions and expressions</h2></div></div></div>
      
      <p>Well, bottomline there is no difference or distinction between <span class="emphasis"><em>conditions</em></span> and <span class="emphasis"><em>expressions</em></span>, at least as <span class="application">yabasic</span> is concerned. So you may assign the result of comparisons to variables or use an arithmetic expression or a simple variable within a condition (e.g. within an <code class="function">if</code>-statement). So the constructs shown in the example below are all totally valid:</p>
      <div class="informalexample">
	<pre class="programlisting">
input "Please enter a number between 1 and 10: " a

rem   Assigning the result of a comparison to a variable
okay=a&gt;=1 and a&lt;=10

rem   Use a variable within an if-statement
if (not okay) error "Wrong, wrong !"
</pre>
      </div>
      <p>So conditions and expressions are really the same thing (at least as long as yabasic is concerned). Therefore the terms <em class="wordasword">conditions</em> and <em class="wordasword">expression</em> can really be used interchangeably, at least in theory. In reality the term <em class="wordasword">condition</em> is used in connection with <code class="function">if</code> or <code class="function">while</code> whereas the term <em class="wordasword">expression</em> tends to be used more often within arithmetic context.</p>
    </section>

    <section class="section" id="ref_comparing_strings_or_numbers"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Comparing strings or numbers</h2></div></div></div>
      
      <p><span class="application">Yabasic</span>, of course, allows to compare strings with strings and numbers with numbers; <code class="function">&lt;</code>, <code class="function">&lt;=</code>, <code class="function">&gt;</code> and <code class="function">&gt;=</code> compare their left-hand side to their right-hand side as usual; nothing new here and examples can be found throughout this manual.</p>
      <p>More interesting, the <span class="emphasis"><em>equality</em></span>-operator (for numbers as well as for strings) can be written <span class="emphasis"><em>in two different ways</em></span>: either as <code class="function">=</code> (traditional) or as <code class="function">==</code> (more modern). The second form has the advantage of beeing visually distinct from the <span class="emphasis"><em>assignment</em></span>-operator, which is the single <code class="function">=</code>. One may argue therefore, that using <code class="function">==</code> results in code, that is easier to understand and read; This manual however sticks to tradition and mostly uses the single <code class="function">=</code> for equality-check.</p>
      <p>Finally, <span class="emphasis"><em>inequality</em></span> can be checked with <code class="function">&lt;&gt;</code> or <code class="function">!=</code>; both operators behave identically and so it is only a matter of taste, which one to use.</p>
    </section>

    <section class="section" id="ref_array_references"><div class="titlepage"><div><div><h2 class="title" style="clear: both">References on arrays</h2></div></div></div>
      
      <p><span class="emphasis"><em>References on arrays</em></span> are the only way to refer to an array <span class="emphasis"><em>as a whole</em></span> and to pass it to subroutines or functions like <a class="link" href="#ref_arraydim" title="arraydim()"><code class="function">arraydim</code></a> or <a class="link" href="#ref_arraysize" title="arraysize()"><code class="function">arraysize</code></a>.</p>
      <p>While (for example) <code class="literal">a(2)</code> designates the second element of the array <code class="literal">a</code>, <code class="literal">a()</code> (with empty braces) refers to the array <code class="literal">a</code> itself. <code class="literal">a()</code> is called an <span class="emphasis"><em>array reference</em></span>. A nice example is the bultin function <a class="link" href="#ref_split" title="split()"><code class="function">split</code></a>, that accepts an array-reference and modifies the content of this array.</p>
      <p>You may also pass to and use array reference within your own subroutines; these subroutines will then be able to modify the array you have passed in often this is intended.</p>
      <p>Passing an array reference does not create a copy of the array; this has some interesting consequences:</p>
      <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	  <p><span class="emphasis"><em>Speed and space:</em></span> Creating a copy of an
array would be a time and memory consuming operation; passing just a reference is cheap and fast.</p>
	</li><li class="listitem">
	  <p>Returning many values: A subroutine, that wants to give back more than one value, may require an array reference among its arguments and then store its many return values within this array. This is the only way to return more than one value from a subroutine.</p>
	</li></ul></div>
      <section class="section" id="id1346"><div class="titlepage"><div><div><h3 class="title">An example</h3></div></div></div>
	
      	<div class="informalexample">
	  <p>The following program creates two subroutines (<code class="function">print_words</code> and <code class="function">upcase_words</code>), that operate on an array of words (<code class="literal">words$()</code> below):</p>
	    <pre class="programlisting">
dim words$(4)
for i=1 to 4
  read words$(i)
next i

print_words(words$())
upcase_words(words$())
print_words(words$())

sub print_words(w$())
  local i
  for i=1 to arraysize(w$(),1)
    print w$(i)," ";
  next i
  print    
end sub

sub upcase_words(w$())
  local i
  for i=1 to arraysize(w$(),1)
    w$(i) = upper$(w$(i))
  next i
end sub

data "case","does","not","matter"
            </pre>
	    <p>If you run this program, you will get this output:</p>
	    <pre class="screen">
	      <code class="computeroutput">
case does not matter
CASE DOES NOT MATTER		
	      </code>
	    </pre>
	  </div>
      </section>
    </section>


    <section class="section" id="ref_windows_filenames"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Specifying Filenames under Windows</h2></div></div></div>
      
      <p>As you probably know, windows uses the character '<code class="literal">\</code>' to separate the directories within a pathname; an example would be <code class="literal">C:\programs\yabasic\yabasic.exe</code> (a possible location of the <span class="application">yabasic</span> executable). However, the very same character '<code class="literal">\</code>' is used to construct <a class="link" href="#ref_escape_sequences" title="Escape-sequences">escape sequences</a>, not only in <span class="application">yabasic</span> but in most other programming languages.</p>
      <p>Therefore e.g. the string <code class="literal">"C:\t.dat"</code> does <span class="emphasis"><em>not</em></span> specify the file <code class="literal">t.dat</code> within the directory <code class="literal">C:</code>; this is because the sequence '<code class="literal">\t</code>' is translated into the tab-character (and thus giving a rather unusal filename containing a tab). To specify this filename, you need to use the string <code class="literal">"C:\\t.dat"</code> (note the double slash '<code class="literal">\\</code>').</p>
    </section>


    <section class="section" id="ref_escape_sequences"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Escape-sequences</h2></div></div></div>
      
      <p><span class="emphasis"><em>Escape-sequences</em></span> are the preferred way of specifying 'special' characters. They are introduced by the '\'-character and followed by one of a few regular letters, e.g. '\n' or '\r' (see the table below).</p>
      <p>Escape-sequences may occur within any string at any position; they are replaced at <span class="emphasis"><em>parsetime</em></span> (opposed to <span class="emphasis"><em>runtime</em></span>), i.e. as soon as <span class="application">yabasic</span> discovers the string, with their corresponding <span class="emphasis"><em>special</em></span> character. As a consequence of this <code class="function">len("\a")</code> returns 1, because <span class="application">yabasic</span> replaces <code class="function">"\a"</code> with the matching special character just before the program executes.</p>
      <div class="table" id="id2753"><div class="table-title">Table&#160;6.1.&#160;Escape sequences</div><div class="table-contents">
	
	<table style="border-collapse: collapse; border-top: 1px solid ; border-bottom: 1px solid ; border-left: 1px solid ; border-right: 1px solid ; "><colgroup><col/><col/></colgroup><thead><tr><th style="border-right: 1px solid ; border-bottom: 1px solid ; ">Escape Sequence</th><th style="border-bottom: 1px solid ; ">Matching special character</th></tr></thead><tbody><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">\n</code></td><td style="border-bottom: 1px solid ; "><span class="emphasis"><em>newline</em></span></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">\t</code></td><td style="border-bottom: 1px solid ; "><span class="emphasis"><em>tabulator</em></span></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">\v</code></td><td style="border-bottom: 1px solid ; "><span class="emphasis"><em>vertical tabulator</em></span></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">\b</code></td><td style="border-bottom: 1px solid ; "><span class="emphasis"><em>backspace</em></span></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">\r</code></td><td style="border-bottom: 1px solid ; "><span class="emphasis"><em>carriage return</em></span></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">\f</code></td><td style="border-bottom: 1px solid ; "><span class="emphasis"><em>formfeed</em></span></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">\a</code></td><td style="border-bottom: 1px solid ; "><span class="emphasis"><em>alert</em></span> (i.e. a beeping sound)</td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">\\</code></td><td style="border-bottom: 1px solid ; "><span class="emphasis"><em>backslash</em></span></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">\'</code></td><td style="border-bottom: 1px solid ; "><span class="emphasis"><em>single quote</em></span></td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">\"</code></td><td style="border-bottom: 1px solid ; "><span class="emphasis"><em>double quote</em></span></td></tr><tr><td style="border-right: 1px solid ; "><code class="computeroutput">\x</code><span class="emphasis"><em>HEX</em></span></td><td><code class="function">chr$(</code><span class="emphasis"><em>HEX</em></span><code class="function">)</code> (see below)</td></tr></tbody></table>
      </div></div><br class="table-break"/>
      <p>Note, that an escape sequences of the form \xHEX allows one to encode arbitrary
     characters as long as you know their position (as a hex-number) within the 
     <abbr class="acronym">ascii</abbr>-charset: 
     For example \x012 is transformed into the character <code class="function">chr$(18)</code> (or <code class="function">chr$(dec("12",16))</code>. Note that \x requires a
     hexa-decimal number (and the hexadecimal string "12" corresponds to the decimal number 18).</p> 
    </section>


    <section class="section" id="ref_subroutines"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Subroutines: Sharing code within one program</h2></div></div></div>
      
      <section class="section" id="id1347"><div class="titlepage"><div><div><h3 class="title">Purpose</h3></div></div></div>
	
	<p>Nobody wants to repeat oneself and therefore <span class="application">yabasic</span> allows to collect arbitrary code into <span class="emphasis"><em>subroutines</em></span>, so that you may call it from <span class="emphasis"><em>multiple</em></span> locations within you program. To this end, two conditions must be fulfilled:</p>
	<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
	    <p>The subroutine neeeds to know details about what to do; that's why subroutines have <span class="emphasis"><em>parameters</em></span>. E.g. in the overly simple subroutine <code class="code">sub add(a,b)</code> (see the example below) the parameters would be <code class="varname">a</code> and <code class="varname">b</code>, specifying, which numbers to add.</p>
	    <p class="remark"><em><span class="remark">Remark: In certain cases a subroutine may want to find out, how many parameters it has been called with, by querying the special variable <code class="varname"><a class="link" href="#ref_numparams" title="numparams">numparams</a></code>.</span></em></p>
	  </li><li class="listitem">
	    <p>The subroutine needs to run without messing up the state of the program, at the point where it has been called. That's why many subroutines use <code class="function"><a class="link" href="#ref_local" title="local">local</a></code> variables, which are different and isolated from all other variables in your program, even if they happen to have the same name. <span class="emphasis"><em>parameters</em></span> (as described above) are, in addition to their primary function, also local variables.</p>
	    <p class="remark"><em><span class="remark">Remark: If a subroutine wants to remember some information between invocations, it may declare some of its variables as <code class="function"><a class="link" href="#ref_static" title="static">static</a></code> instead of <code class="function"><a class="link" href="#ref_local" title="local">local</a></code> function</span></em></p>
	  </li></ol></div>
	<p>To see these concepts explained in more detail (complete with examples), follow the links at the end of this section.</p>
	<p class="remark"><em><span class="remark">Remark: You may notice, that other programming language may use other terms than subroutine for the same concept: <code class="function">function</code> or <code class="function">procedure</code> have been popular for pieces of code, that either return a value or not, and in other languages <code class="function">def</code> is used to name both. And the term <code class="function">method</code> is used in object-oriented languages. However <span class="application">yabasic</span> is not object oriented, and regardless, if a piece of code produces a value or not, it can be encapsulated in a subroutine, so yabasic uses the function <code class="function">sub</code> throughout.</span></em></p>
      </section>
      <section class="section" id="id1348"><div class="titlepage"><div><div><h3 class="title">A simple example</h3></div></div></div>
	
	<p>The short program below does nothing more than to add two numbers; for this purpose, it even defines a subroutine. This admittedly is more overhead, than you would normally take.</p>
	<pre class="programlisting">
print "About to add two numbers."
input "Please enter first number: " x
input "Please enter second number: " y
print "Their sum is: ", add(x,y)

sub add(a,b)
  return a+b
end sub
	</pre>
	<p>If you run it, you would see:</p>
	<pre class="screen">
	  <code class="computeroutput">
About to add two numbers.
Please enter first number: 2
Please enter second number: 3
Their sum is: 5
	</code>
	</pre>
	<p>Again, see the link at the end of this section for more explanations and examples (e.g. on <code class="function">local</code> or <code class="function">static</code>, which have only been mentioned but not shown at work so far).</p>
      </section>
      <section class="section" id="id1349"><div class="titlepage"><div><div><h3 class="title">See also</h3></div></div></div>
	
	<p><a class="link" href="#top_sub" title="Subroutines">All commands for subroutines</a>, where you will find links to the individual keywords related.</p>	     
      </section>
    </section>

    
    <section class="section" id="ref_libraries"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Libraries: Sharing code between many programs</h2></div></div></div>
      
      <section class="section" id="id1350"><div class="titlepage"><div><div><h3 class="title">Purpose</h3></div></div></div>
	
	<p><span class="emphasis"><em>Libraries</em></span> build upon <code class="function"><a class="link" href="#ref_subroutines" title="Subroutines: Sharing code within one program">subroutines</a></code> and take the concept of code-reuse one step further: They allow code to be shared between <span class="emphasis"><em>different</em></span> programs (as compared to subroutines, which on their own allow code-reuse within a single program only). Moreover, it is possible and in fact common, that the author of a library and the author of a program using that library, are different persons, each writing their respective code on their own.</p>
      </section>
      <section class="section" id="id1351"><div class="titlepage"><div><div><h3 class="title">A simple example</h3></div></div></div>
	
	<p>Here is a program, that asks the user for two numbers and then uses a library <code class="function">adder</code> to add those:</p>
	<pre class="programlisting">
import adder
	  
print "About to add two numbers."
input "Please enter first number: " x
input "Please enter second number: " y
print "Their sum is: ", adder.add(x,y)
	</pre>
	<p>The statement <code class="code">import adder</code> pulls in code from a very simple <span class="emphasis"><em>library</em></span> <code class="filename">adder.yab</code>:</p>
	<pre class="programlisting">
sub add(a,b)
  return a+b
end sub
	</pre>
	<p>If you run it, you might see:</p>
	<pre class="screen">
	  <code class="computeroutput">
About to add two numbers.
Please enter first number: 3
Please enter second number: 4
Their sum is: 7
	  </code>
	</pre>
	<p>Compared with the very similar example for <a class="link" href="#ref_subroutines" title="Subroutines: Sharing code within one program">subroutines</a>, there are two differences:</p>
	<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
	    <p>The code of the subroutine <code class="function">add</code> has been moved to its own file <code class="filename">adder.yab</code>.</p>
	  </li><li class="listitem">
	    <p>The subroutine <code class="function">add</code> needs to be called as <code class="function">adder.add</code>, which consists of filename (<code class="filename">adder.yab</code> but without the ending <code class="filename">.yab</code>) and the name of the subroutine (<code class="function">add</code>) within that file.</p>
	  </li></ol></div>
	<p>This is an example of <span class="emphasis"><em>namespaces</em></span>.</p>
      </section>
      <section class="section" id="id1352"><div class="titlepage"><div><div><h3 class="title">Namespaces</h3></div></div></div>
	
	<p>
	</p>
	<p>When the executable code is devided between a <span class="emphasis"><em>main program file</em></span> and (multiple) <span class="emphasis"><em>libraries</em></span> it is important to keep their subroutines and variables seperate. To this end <span class="application">yabasic</span> internally prefixes the subroutines and variables defined in a library with the shortened name of the library. E.g. in the example above, the subroutine <code class="function">add</code> from the library <code class="filename">adder.yab</code> is prefixed by this library-name and ends up as beeing defined as <code class="function">adder.add</code>.</p> 
	<p>Subroutines and variables defined within the main program are prefixed with <code class="function">main</code>; this prefix is fixed and not related to the actual filename of the main-program. Normally, however, there is no need to use this prefix explicitly; it only helps <span class="application">yabasic</span> to keep everything apart.</p>
      </section>
      <section class="section" id="id1353"><div class="titlepage"><div><div><h3 class="title">See also</h3></div></div></div>
	
	<p><code class="function"><a class="link" href="#ref_import" title="import">import</a></code>, <code class="function"><a class="link" href="#ref_export" title="export">export</a></code>, <a class="link" href="#ref_subroutines" title="Subroutines: Sharing code within one program">subroutines</a></p>	      
      </section>
    </section>
      

    <section class="section" id="ref_add_code"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Adding code to a running program</h2></div></div></div>
      
      <section class="section" id="id1354"><div class="titlepage"><div><div><h3 class="title">Purpose</h3></div></div></div>
	
	<p>Normally, you write programs in yabasic and specify all the necessary logic and calculations within your program. Once you are done, you invoke it, probably multiple times; and while it is running, it does not change.</p>
	<p>However, there are some commands within <span class="application">yabasic</span>, that allow to blur the line between writing and execution. Namely <code class="function"><a class="link" href="#ref_eval" title="eval()">eval</a></code>, <code class="function"><a class="link" href="#ref_eval2" title="eval$()">eval$</a></code>, <code class="function"><a class="link" href="#ref_compile" title="compile">compile</a></code>, <code class="function"><a class="link" href="#ref_execute" title="execute()">execute</a></code> and <code class="function"><a class="link" href="#ref_execute2" title="execute$()">execute$</a></code> allow to create and execute new <span class="application">yabasic</span>-code while your program is running. This comes in handy, if the code to be used comes from the user of your program and will only be known <span class="emphasis"><em>after</em></span> your program has started. A simple example is the <span class="application">yabasic</span>-code to calculate the maximum of a user-supplied expression within a given range; find it as an example for <code class="function"><a class="link" href="#ref_eval" title="eval()">eval</a></code>. In the same way, one may write a program to plot an arithmetic function, whose definition is entered by the user.</p>
	<p>Note: Even if the commands listed above allow to change the <span class="application">yabasic</span>-program, that is currently running, the <span class="emphasis"><em>file</em></span> where the program is stored, does not change. Therefore, the changes to the running program are not permanent.</p>
      </section>

      <section class="section" id="id1355"><div class="titlepage"><div><div><h3 class="title">How the various functions and commands differ</h3></div></div></div>
	
	<p>The most simple functions are <code class="function"><a class="link" href="#ref_eval" title="eval()">eval</a></code> and <code class="function"><a class="link" href="#ref_eval2" title="eval$()">eval$</a></code>; they compile an expression (with a numeric or string result), e.g. and execute it right away. The compiled code is remembered, so that it need not be compiled again, when the sames expression is executed again; this caters efficiency. However these functions only accept a <span class="emphasis"><em>single expression</em></span> and nothing else.</p>
	<p>
	  If you need more complex computation and logic, the process needs to be split: First create a new subroutine with the <code class="function"><a class="link" href="#ref_compile" title="compile">compile</a></code>-command, then execute this subroutine (maybe multiple times) via <code class="function"><a class="link" href="#ref_execute" title="execute()">execute</a></code> or <code class="function"><a class="link" href="#ref_execute2" title="execute$()">execute$</a></code>. This allows to use the broad logic available in subroutines (e.g. conditions, loops, local variables or even other subroutines) and therefore much more complex calculations than with <code class="function"><a class="link" href="#ref_eval" title="eval()">eval</a></code>. If you want to use <code class="function"><a class="link" href="#ref_compile" title="compile">compile</a></code> multiple times within your program (e.g. in a loop), you may want to enumerate the functions you create to avoid name-clashes (as shown in the examples of <code class="function"><a class="link" href="#ref_compile" title="compile">compile</a></code>).
	</p>
	<p>To invoke the subroutines created, you need to execute them with <code class="function"><a class="link" href="#ref_execute" title="execute()">execute</a></code> or <code class="function"><a class="link" href="#ref_execute2" title="execute$()">execute$</a></code>, which require the name of the function (a string) as their first argument.</p>
      </section>
    </section>
    
    <section class="section" id="ref_standalone"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Creating a <span class="emphasis"><em>standalone</em></span> program from your yabasic-program</h2></div></div></div>
      
      <p>Sometimes you may want to give one of your yabasic-programs to other people. However, what if those other people do not have <span class="application">yabasic</span> installed ? In that case you may create a <span class="emphasis"><em>standalone</em></span>-program from your yabasic-program, i.e. an executable, that may be executed on its own, standalone, even (and especially !) on computers, that do not have <span class="application">yabasic</span> installed. Having created a standalone program, you may pass it around like any other program (e.g. one written in <span class="application">C</span>) and you can be sure that your program will execute right away.</p>
      <p>Such a standalone-program is simply created by copying the full <span class="application">yabasic</span>-interpreter and your yabasic-program (plus all the libraries that it may <code class="function">import</code>) together into a single, new program, whose name might be chosen at will (under windows of course it should have the ending <code class="filename">.exe</code>). If you decide to create a standalone-program, there are three facilities in yabasic, that you may use:</p>
      <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	  <p>The <code class="function"><a class="link" href="#ref_bind" title="bind()">bind</a></code>-command, which does the actual job of creating the standalone program from the <span class="application">yabasic</span>-interpreter and your program.</p>
	</li><li class="listitem">
	  <p>The command-line Option <code class="literal">--bind</code> (see <a class="link" href="#chapter_options" title="Chapter&#160;4.&#160;Command line options of yabasic">options</a>), which does the same from the command-line.</p>
	</li><li class="listitem">
	  <p>The special <code class="function"><a class="link" href="#ref_peek" title="peek">peek("isbound")</a></code>, which may be used to check, if the <span class="application">yabasic</span>-program containing this <code class="function">peek</code> is bound to the interpreter as part of a standalone program.</p>
	</li></ul></div>
      <p>With these bits you know enough to create a standalone-program. Actually there are two ways to do this: on the command line and from within your program.</p>
      <section class="section" id="id1356"><div class="titlepage"><div><div><h3 class="title">Creating a standalone-program from the command line</h3></div></div></div>
	
	<p>Let's say you have the following <span class="emphasis"><em>very</em></span> simple program within the file <code class="filename">foo.yab</code>:</p>
	<div class="informalexample">
	  <pre class="programlisting">
print "Hello World !"
</pre>
	</div>
	<p>Normally you would start this <span class="application">yabasic</span>-program by typing <strong class="userinput"><code>yabasic foo.yab</code></strong> and as a result the string <code class="computeroutput">Hello World !</code> would appear on your screen. However, to create a <span class="emphasis"><em>standalone</em></span>-program from <code class="filename">foo.yab</code> you would type:</p>
	<div class="informalexample">
	  <p><strong class="userinput"><code>yabasic -bind foo.exe foo.yab</code></strong></p>
	</div>
	<p>This command does <span class="emphasis"><em>not</em></span> execute your program <code class="filename">foo.yab</code> but rather create a <span class="emphasis"><em>standalone</em></span>-program <code class="filename">foo.exe</code>. Note: under Unix you would probably name the standalone program <code class="filename">foo</code> or such, omitting the windows-specific ending <code class="filename">.exe</code>. </p>
	<p><span class="application">Yabasic</span> will confirm by printing something like: <code class="computeroutput">---Info: Successfully bound 'yabasic' and 'foo.yab' into 'foo.exe'</code>.</p>
	<p>After that you will find a program <code class="filename">foo.exe</code> (which must be made <span class="emphasis"><em>executable</em></span> with the <span class="command"><strong>chmod</strong></span>-command under Unix first). Now, executing this program <code class="filename">foo.exe</code> (or <code class="filename">foo</code> under Unix) will produce the output <code class="computeroutput">Hello World !</code>.</p>
	<p>This newly created program <code class="filename">foo.exe</code> might be passed around to anyone, even if he does not have <span class="application">yabasic</span> installed.</p>
      </section>
      <section class="section" id="id1357"><div class="titlepage"><div><div><h3 class="title">Creating a standalone-program from within your program</h3></div></div></div>
	
	<p>It is possible to write a <span class="application">yabasic</span>-program, that binds itself to the <span class="application">yabasic</span>-interpreter. Here is an example:</p>
	<div class="informalexample">
	  <pre class="programlisting">
if (!peek("isbound")) then
  bind "foo"
  print "Successfully created the standalone executable 'foo' !"
  exit
endif

print "Hello World !"
</pre>
	</div>
	<p>If you run this program (which may be saved in the file <code class="filename">foo.yab</code>) via <strong class="userinput"><code>yabasic foo.yab</code></strong>, the <code class="function"><a class="link" href="#ref_peek" title="peek">peek("isbound")</a></code> in the first line will check, if the program is already part of a standalone-program. If <span class="emphasis"><em>not</em></span> (i.e. if the <span class="application">yabasic</span>-interpreter and the <span class="application">yabasic</span>-program are separate files) the <code class="function"><a class="link" href="#ref_bind" title="bind()">bind</a></code>-command will create a standalone program <code class="filename">foo</code> containing both. As a result you would see the output <code class="computeroutput">Successfully created the standalone executable 'foo' !</code>. Note: Under Windows you would probably choose the filename <code class="filename">foo.exe</code>.</p>
	<p>Now, if you run this standalone executable <code class="filename">foo</code> (or <code class="filename">foo.exe</code>), the very same <span class="application">yabasic</span>-program that is shown above will be executed again. However, this time the <code class="function"><a class="link" href="#ref_peek" title="peek">peek("isbound")</a></code> will return <code class="constant">TRUE</code> and therefore the condition of the <code class="function">if</code>-statement is <span class="emphasis"><em>false</em></span> and the three lines after <code class="function">then</code> are <span class="emphasis"><em>not</em></span> executed. Rather the last <code class="function">print</code>-statement will run, and you will see the output <code class="computeroutput">Hello World !</code>.</p>
	<p>That way a <span class="application">yabasic</span>-program may turn itself into a standalone-program.</p>
      </section>
      <section class="section" id="id1358"><div class="titlepage"><div><div><h3 class="title">Points to consider before creating a standalone program</h3></div></div></div>
	
	<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	    <p>The new standalone program will be at least as big as the interpreter itself, which is typically a few hundred kilobytes.</p>
	  </li><li class="listitem">
	    <p>There is no easy way to extract your <span class="application">yabasic</span>-program from within the standalone program: If you ever want to change it, you should keep it around as a separate file.</p>
	  </li><li class="listitem">
	    <p>If a new version of <span class="application">yabasic</span> becomes available, you might want to recreate your standalone program to take advantage of bugfixes and improvements.</p>
	  </li></ul></div>
      </section>
      <section class="section" id="id1359"><div class="titlepage"><div><div><h3 class="title">See also</h3></div></div></div>
	
	<p>The <a class="link" href="#ref_bind" title="bind()"><code class="function">bind</code></a>-command, the <a class="link" href="#ref_peek" title="peek"><code class="function">peek</code></a>-function and the command line <a class="link" href="#chapter_options" title="Chapter&#160;4.&#160;Command line options of yabasic">options</a>.</p>
      </section>
    </section>


    <section class="section" id="ffi"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Interaction with functions from a non-<span class="application">yabasic</span> library or dll</h2></div></div></div>
      
	  <div class="note"><h3 class="title">Note</h3>
	    <p>Under Unix, depending on the way <span class="application">yabasic</span> has been built, this feature might have been disabled; the error message in this case will read like <code class="computeroutput">this build of yabasic does not support calling foreign libraries</code>. To resolve this issue, you are invited to contact the maintainer.</p>
	  </div>

	  <div class="note"><h3 class="title">Note</h3>
	    <p>This is interesting, but somewhat advanced stuff. You will need a good understanding of various concepts of the <span class="application">C</span>-language, especially <span class="emphasis"><em>pointers</em></span> and <span class="emphasis"><em>structures</em></span> as well as allocating and freeing blocks of memory. Please be aware, that mistakes or errors during calls to foreign functions or buffers may easily crash <span class="application">yabasic</span>.</p>
	  </div>

      <p><span class="application">Yabasic</span> allows to employ functionality from 
an external library; i.e. from a library, which is <span class="emphasis"><em>not</em></span> written in <span class="application">yabasic</span>, but rather in <span class="application">C</span>; such a library is called a <span class="emphasis"><em>foreign</em></span> library, as opposed to a library written in yabasic itself. Calling out to a foreign library can be useful, if such a library provides functionality, that can not be replicated in <span class="application">yabasic</span> itself and for which a commandline-interface (which could be used via <code class="function"><a class="link" href="#ref_system" title="system()">system</a></code>) does not exist or is too cumbersome or slow. Examples would be libraries <span class="application">libVLC</span> or <span class="application">libcurl</span> which offer the functionality of <span class="application">vlc</span> or <span class="application">curl</span> to other programs, especially programs written in <span class="application">yabasic</span>.</p>
<p>The foreign function interface of <span class="application">yabasic</span> relies on the great <a class="ulink" href="https://sourceware.org/libffi/" target="_top">libffi</a>-library, a library making it easy to call other libraries dynamicaaly and the established standard for this task.</p>

<section class="section" id="background_ffi"><div class="titlepage"><div><div><h3 class="title">Some Background</h3></div></div></div>

<section class="section" id="id1360"><div class="titlepage"><div><div><h4 class="title">Libraries</h4></div></div></div>
  
  <p>
  Libraries (e.g. <span class="application">libcurl</span>) are meant to provide functionality to other programs (here: <span class="application">yabasic</span> and your <span class="application">yabasic</span>-program). Libraries and programs must be <span class="emphasis"><em>linked</em></span> together; this can happen either <span class="emphasis"><em>statically</em></span> at compile-time or <span class="emphasis"><em>dynamically</em></span> during the excution of the program. For <span class="application">yabasic</span> as the program, static linking happens at the time, <span class="application">yabasic</span> itself is build, whereas dynamic linking happen during the execution <span class="emphasis"><em>and under control</em></span> of your <span class="application">yabasic</span>-program. So the foreign function interface deals with dynamic (or <span class="emphasis"><em>runtime</em></span>) linking to external libraries. This linking is done by <span class="application">yabasic</span> behind the scene, when you invoke <code class="function"><a class="link" href="#ref_foreign_function_call" title="foreign_function_call()">foreign_function_call</a></code>; this function, after loading the library, directly calls the specified function therein.</p>
<p>Which functions are available differs from library to library and you should already have this information before you try the library with <span class="application">yabasic</span>.
</p>
</section>

<section class="section" id="id1361"><div class="titlepage"><div><div><h4 class="title">Types</h4></div></div></div>
  
  <p>If you want to use a function from a foreign library, you will need to deal with the fact, that each function requires several parameters and returns exactly one. These parameters have a wide variety of types which need to be mapped to the two types (numbers and strings) known by <span class="application">yabasic</span>. Here are the types available for foreign functions, grouped by the way, they are handled in <span class="application">yabasic</span>:</p>
  <div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">uint8</code>,<code class="literal">int8</code>,<code class="literal">uint16</code>,<code class="literal">int16</code>,<code class="literal">uint32</code>,<code class="literal">int32</code>,<code class="literal">uint64</code>,<code class="literal">int64</code>,<code class="literal">float</code>,<code class="literal">double</code>,<code class="literal">char</code>,<code class="literal">short</code>,<code class="literal">int</code>,<code class="literal">long</code></span></dt><dd><p>In <span class="application">C</span> all these types are used to represent numbers (integer or floating point) with various degrees of precision. When invoking <code class="function"><a class="link" href="#ref_foreign_function_call" title="foreign_function_call()">foreign_function_call</a></code> you need to pass strings, which specify the right type as well as the actual <span class="application">yabasic</span>-value, which will then be converted accordingly. Which types a foreign function expects can be looked up e.g. from its manpage.</p></dd><dt><span class="term"><code class="literal">string</code></span></dt><dd><p>Strings for foreign functions directly map to strings of <span class="application">yabasic</span>. So if you specify this type for a parameter of a foreign function, the matching value is simply a <span class="application">yabasic</span> string. If you specify <code class="literal">string</code> as the return value of a foreign function you should use the variant of calling it, which returns a string, i.e. <code class="function"><a class="link" href="#ref_foreign_function_call2" title="foreign_function_call$()">foreign_function_call$</a></code>.</p></dd><dt><span class="term"><code class="literal">buffer</code></span></dt><dd><p>You should specify a <span class="emphasis"><em>buffer</em></span> as the type of a parameter or the return type, if the foreign function expects a structure or a pointer to a memory area; see <a class="link" href="#structures_and_buffers" title="Structurs and buffers">structures and buffers</a> for details.</p></dd></dl></div>
</section>
</section>
<section class="section" id="id1365"><div class="titlepage"><div><div><h3 class="title">Three simple examples</h3></div></div></div>
<section class="section" id="id1362"><div class="titlepage"><div><div><h4 class="title">Computing the cosine</h4></div></div></div>
<p>This first example prints the cosine of 2, not by using <span class="application">yabasics</span> own <code class="function">cos</code>-function but by calling out to the standard <span class="application">C</span>-library:</p>
<pre class="programlisting">
if peek$("os")="windows" then
  lib$ = "msvcrt.dll"
else
  lib$ = "libm.so.6"
endif

print "cos(2): ",foreign_function_call(lib$,"double","cos","double",2)
</pre>
<p>The first lines determine the name of the library, which is different under Unix and Windows. The call to <code class="function"><a class="link" href="#ref_foreign_function_call" title="foreign_function_call()">foreign_function_call</a></code> than just states the name of the library, the return type (<code class="literal">"double"</code>) of the function and then its name (<code class="literal">"cos"</code>), as well as type and value (<code class="literal">2</code>) of its argument. The final result <code class="computeroutput">-0.416147</code> then is the same as from the the internal <code class="function"><a class="link" href="#ref_cos" title="cos()">cos</a></code>-function, which is no surprise, because <span class="application">yabasic</span> is already statically linked to the standard <span class="application">C</span>-library and uses its function to compute the cosine.</p>
</section>
<section class="section" id="id1363"><div class="titlepage"><div><div><h4 class="title">Searching a string within another string</h4></div></div></div>
<p>A second example:</p>
<pre class="programlisting">
if peek$("os")="windows" then
  lib$ = "msvcrt.dll"
else
  lib$ = "libm.so.6"
endif

print foreign_function_call$(lib$,"string","strstr","string","foobar","string","ob","options","copy_string_result")
</pre>
<p>This example calls the <code class="function">strstr</code>-function from the standard <span class="application">C</span>-library; this function accepts two string arguments and returns a string, which is the first (if any) appearance of the second string within the first one (remark: this function makes more sense in <span class="application">C</span> than in <span class="application">yabasic</span>). Please note the option <code class="literal">"copy_string_result"</code>, which advices <span class="application">yabasic</span> to return a copy of the result of <code class="function">strstr</code>; otherwise your program might crash, because <code class="function">strstr</code> simply returns a pointer to a part of its first argument, a string that will later be freed by <span class="application">yabasic</span>.</p>
</section>

<section class="section" id="id1364"><div class="titlepage"><div><div><h4 class="title">Showing a message box under Windows</h4></div></div></div>
<p>This example is windows only; it shows a standard Windows message box with the given title and message:</p>
<pre class="programlisting">
message_box("Hello World !","Message from yabasic")

sub message_box(message$, title$)
  msgptr$ = foreign_buffer_alloc$(len(message$)+1)
  foreign_buffer_set msgptr$, 0, message$
  titleptr$ = foreign_buffer_alloc$(len(title$)+1)
  foreign_buffer_set titleptr$, 0, title$
  hwnd$ = foreign_function_call$("user32.dll", "buffer", "GetActiveWindow")
  ret = foreign_function_call("user32.dll", "int32", "MessageBoxA", "buffer", hwnd$, "buffer", msgptr$, "buffer", titleptr$, "uint32", 0)
  foreign_buffer_free msgptr$
  foreign_buffer_free titleptr$
  return ret
end sub
</pre>
<p>The relevant Windows-function <code class="function">MessageBoxA</code> is found within the library <code class="filename">user32.dll</code>; most of the example deals with properly allocating, handling and freeing buffers to hold the supplied text-snippets. Thanx to <span class="emphasis"><em>Jean-Marc Duro</em></span> for this example.</p>
</section>
</section>

<section class="section" id="steps_during_foreign_call"><div class="titlepage"><div><div><h3 class="title">Internal steps during a call to a foreign function</h3></div></div></div>
<p>A remark on <a class="ulink" href="https://sourceware.org/libffi/" target="_top">libffi</a>: this is the library which allows <span class="application">yabasic</span> to call functions from other libraries <span class="application">libffi</span> is used by many other programming-languages for the same purpose; in <span class="application">yabasic</span> it is linked statically (rather than dynamically) so that its functionality is available right from the start. Summing up: <span class="application">libffi</span> itself need not be loaded but helps to call functions from other loaded libraries.</p>
<p>Here is the sequence of events during a foreign function call (e.g. <code class="function"><a class="link" href="#ref_foreign_function_call" title="foreign_function_call()">foreign_function_call</a></code>):</p>
      <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="application">Yabasic</span> parses the type specifications and argument values provided and collects the necessary information for <span class="application">libffi</span>.</p></li><li class="listitem"><p>The named library is loaded with the appropriate call (which is different under Windows and Unix). This step might easily fail, e.g. if you misspelled the name of the library or your system cannot find the library.</p></li><li class="listitem"><p>With the help of <span class="application">libffi</span> the named function is invoked.</p></li><li class="listitem"><p>If you specified the option <code class="literal">unload_library</code>, the library that has been loaded is unloaded again.</p></li><li class="listitem"><p>The return value of the function is converted to a form suitable for <span class="application">yabasic</span> and your program continues.</p></li></ul></div>
<p>Errors are reported during every step.</p>
</section>

<section class="section" id="id1366"><div class="titlepage"><div><div><h3 class="title">Abbreviations for long names</h3></div></div></div>
  
  <p><span class="application">Yabasics</span> functions for dealing with foreign libraries start with <code class="function">foreign_function</code> or <code class="function">foreign_buffer</code> (e.g. <code class="function"><a class="link" href="#ref_foreign_buffer_alloc" title="foreign_buffer_alloc$()">foreign_buffer_alloc</a></code>). To help in typing, these names can all be abbreviated by contracting <code class="literal">foreign_function</code> into <code class="literal">frnfn</code> and <code class="literal">foreign_buffer</code> into <code class="literal">frnbf</code>. In the examples below, both forms appear.</p>
</section>

<section class="section" id="structures_and_buffers"><div class="titlepage"><div><div><h3 class="title">Structurs and buffers</h3></div></div></div>
<p>The <span class="application">C</span>-language provides a wide variety of simple datatypes (like numbers an strings) and allows to aggregate simple datatypes to <span class="emphasis"><em>structures</em></span> such a structure contains a set of simple types arranged without overlap (but sometimes with gaps). <span class="application">Yabasic</span> on itself does not know the internals of a structure but rather treats it as a uniform <span class="emphasis"><em>buffer</em></span>. Structure and buffer are just flipsides of the same memory area viewed either from <span class="application">C</span> or <span class="application">yabasic</span>. For your <span class="application">yabasic</span>-program a buffer is represented by a <span class="emphasis"><em>handle</em></span>, which is just a simple printable string (containing the size and the memory adress).</p>

<p>The detailed knowledge about the simple types within a structure must be coded into your program, which uses the command (or function) <code class="function"><a class="link" href="#ref_foreign_buffer_set" title="foreign_buffer_set">foreign_buffer_set</a></code> and <code class="function"><a class="link" href="#ref_foreign_buffer_get" title="foreign_buffer_get()">foreign_buffer_get</a></code>. Both functions require type and offset (which needs to be looked up in documentation of the foreign library) of the simple type within the structure and a handle to the buffer, which contains the structure.</p>
<p>Beeing essentially a memory area, a buffer is created with <code class="function"><a class="link" href="#ref_foreign_buffer_alloc" title="foreign_buffer_alloc$()">foreign_buffer_alloc</a></code> and destroyed with <code class="function"><a class="link" href="#ref_foreign_buffer_free" title="foreign_buffer_free">foreign_buffer_free</a></code> if needed no more.</p>

<p>Besides representing a structure, a buffer can also provide room to store raw areas of memory for use by the foreign library; example might be image- or sound-content.</p>
</section>

<section class="section" id="id1368"><div class="titlepage"><div><div><h3 class="title">Two more complex examples</h3></div></div></div>
  
  <section class="section" id="id1367"><div class="titlepage"><div><div><h4 class="title">Dealing with time</h4></div></div></div>
    
    <p>The example below deals with the time functions from the standard <span class="application">C</span>-library; some of them deal with the <span class="emphasis"><em>tm</em></span> structure for keeping the segmented time; to understand the example it is good to have the tm-structure at hand; see below. In addition it might be helpful to consult the manpages of the various <span class="application">C</span>-functions (e.g. <code class="function">localtime</code>)involved.</p>
    <pre class="programlisting">
struct tm {
    int tm_sec;    /* Seconds (0-60) */
    int tm_min;    /* Minutes (0-59) */
    int tm_hour;   /* Hours (0-23) */
    int tm_mday;   /* Day of the month (1-31) */
    int tm_mon;    /* Month (0-11) */
    int tm_year;   /* Year - 1900 */
    int tm_wday;   /* Day of the week (0-6, Sunday = 0) */
    int tm_yday;   /* Day in the year (0-365, 1 Jan = 0) */
    int tm_isdst;  /* Daylight saving time */
};
    </pre>
    <p>The example plays with the two forms of keeping the time, either as unix-time (number of seconds since epoch) or as a segmented time (sec, min, etc.). The six steps are each introduced by comments, please see below.</p>
    <pre class="programlisting">
# First: Determine the correct library depending on OS
#
if peek$("os")="windows" then
  lib$ = "msvcrt.dll"
else
  lib$ = "libm.so.6"
endif

# Second: Get the unix-time
#
# time() has a pointer argument to store the result (in addition to returning it)
# we pass NULL, so only the return value is relevant
#
null$ = foreign_buffer_alloc$(-1)
now = foreign_function_call(lib$,"int","time","buffer",null$)
print "Seconds since the epoch: ",now

# Third: Convert the unix-time to a segmented time
#
# localtime() does not accept the time-value as an argument, but rather requires a pointer
# to the time-value, so we construct a buffer for one int and put in our value
now$ = foreign_buffer_alloc$(foreign_function_size("int"))
foreign_buffer_set now$,0,"int",now
# Dump the buffer for educational purpose
print "Dump of buffer:          ",foreign_buffer_dump$(now$)
# localtime() returns a structure with the componentes (year, day, sec, etc.) as elements
local$ = foreign_function_call$(lib$,"buffer","localtime","buffer",now$)

# Fourth: Get the current year from the resulting buffer
#
# assuming, that year is the sixth element of the structure
# so offset is 5
offset = 5 * foreign_function_size("int")
year = foreign_buffer_get(local$,offset,"int")
print "Current year:            ", year + 1900


# Fifth: manipulate the segmented time
#
# set year to something else
foreign_buffer_set local$,offset,"int",year-50


# Sixth: convert time-structure from localtime into ascii
#
print "50 years back:           ", foreign_function_call$(lib$,"string","asctime","buffer",local$)
</pre>
<p>On my computer this program produces the following output:</p>
<pre class="screen">
Seconds since the epoch: 1559014899
Dump of buffer:          F3ADEC5C
Current year:            2019
50 years back:           Tue May 28 05:41:39 1969
</pre>
  </section>
  <section class="section" id="example_libcurl"><div class="titlepage"><div><div><h4 class="title">Getting the version of <span class="application">libcurl</span></h4></div></div></div>
    
    <p>This final example just invokes <span class="application">libcurl</span> to report its version. This is somewhat involved, because the matching function <code class="function">curl_version_info</code> (see its man-page) returns a structure, which contains a pointer to a string, as can be seen from the structures definition:</p>
    <pre class="programlisting">
typedef struct {
  CURLversion age;          /* see description below */
  const char *version;      /* human readable string */
  unsigned int version_num; /* numeric representation */
  const char *host;         /* human readable string */
  int features;             /* bitmask, see below */
  char *ssl_version;        /* human readable string */
  long ssl_version_num;     /* not used, always zero */
  const char *libz_version; /* human readable string */
  const char * const *protocols; /* protocols */

  ...                       /* more lines omitted */
  
} curl_version_info_data;
    </pre>
<p>
    Please note, that the <span class="application">yabasic</span>-code below uses abbreviations (e.g. <code class="function">frnfn_call</code> instead of <code class="function">foreign_function_call</code>.</p>
<pre class="programlisting">
# Get structure with version info
info$ = frnfn_call$("libcurl.so.4","buffer","curl_version_info","int",1)
# dump it for reference
print frnbf_dump$(info$,32)
# assume, that the pointer to version string is at offset 8
sinfo$ = frnbf_get_buffer$(info$,8)
# print readable version
print frnbf_get$(sinfo$,0,10)
</pre>
<p>The printing of <code class="function"><a class="link" href="#ref_foreign_buffer_dump" title="foreign_buffer_dump$()">frnbf_dump</a></code> gives a hint on the internal offsets within the structure and helps to determine that offset of 8 for the next call.</p>
<p>On my system this program produces <code class="computeroutput">7.61.1</code> for the version of curl.</p>
</section>
</section>
<section class="section" id="id1369"><div class="titlepage"><div><div><h3 class="title">See also</h3></div></div></div>
  
  	  <p><code class="function"><a class="link" href="#ref_foreign_function_call" title="foreign_function_call()">foreign_function_call</a></code>, <code class="function"><a class="link" href="#ref_foreign_function_call2" title="foreign_function_call$()">foreign_function_call2</a></code>, <code class="function"><a class="link" href="#ref_foreign_function_size" title="foreign_function_size()">foreign_function_size</a></code>, <code class="function"><a class="link" href="#ref_foreign_buffer_alloc" title="foreign_buffer_alloc$()">foreign_buffer_alloc</a></code>, <code class="function"><a class="link" href="#ref_foreign_buffer_free" title="foreign_buffer_free">foreign_buffer_free</a></code>, <code class="function"><a class="link" href="#ref_foreign_buffer_size" title="foreign_buffer_size()">foreign_buffer_size</a></code>, <code class="function"><a class="link" href="#ref_foreign_buffer_dump" title="foreign_buffer_dump$()">foreign_buffer_dump</a></code>, <code class="function"><a class="link" href="#ref_foreign_buffer_set" title="foreign_buffer_set">foreign_buffer_set</a></code>, <code class="function"><a class="link" href="#ref_foreign_buffer_set_buffer" title="foreign_buffer_set_buffer">foreign_buffer_set_buffer</a></code>, <code class="function"><a class="link" href="#ref_foreign_buffer_get" title="foreign_buffer_get()">foreign_buffer_get</a></code>, <code class="function"><a class="link" href="#ref_foreign_buffer_get2" title="foreign_buffer_get$()">foreign_buffer_get2</a></code>, <code class="function"><a class="link" href="#ref_foreign_buffer_get_buffer" title="foreign_buffer_get_buffer$()">foreign_buffer_get_buffer</a></code>, <code class="function"><a class="link" href="#ref_system" title="system()">system</a></code></p>
</section>
</section>
</section>

<section class="chapter" id="chapter_ref_words"><div class="titlepage"><div><div><h1 class="title">Chapter&#160;7.&#160;All commands and functions of <span class="application">yabasic</span> grouped alphabetically</h1></div></div></div><div class="toc"><ul class="toc"><li><span class="section"><a href="#ref_a">A</a></span><ul><li><span class="refentrytitle"><a href="#ref_abs">abs()</a></span><span class="refpurpose"> &#8212; returns the absolute value of its numeric argument</span></li><li><span class="refentrytitle"><a href="#ref_acos">acos()</a></span><span class="refpurpose"> &#8212; returns the arcus cosine of its numeric argument</span></li><li><span class="refentrytitle"><a href="#ref_logical_and">and</a></span><span class="refpurpose"> &#8212; logical and, used in conditions</span></li><li><span class="refentrytitle"><a href="#ref_bitwise_and">and()</a></span><span class="refpurpose"> &#8212; the bitwise arithmetic <code class="function">and</code></span></li><li><span class="refentrytitle"><a href="#ref_arraydim">arraydim()</a></span><span class="refpurpose"> &#8212; returns the dimension of the array, which is passed as an array reference</span></li><li><span class="refentrytitle"><a href="#ref_arraysize">arraysize()</a></span><span class="refpurpose"> &#8212; returns the size of a dimension of an array</span></li><li><span class="refentrytitle"><a href="#ref_asc">asc()</a></span><span class="refpurpose"> &#8212; accepts a string and returns the position of its first character within the <abbr class="acronym">ascii</abbr> charset</span></li><li><span class="refentrytitle"><a href="#ref_asin">asin()</a></span><span class="refpurpose"> &#8212; returns the arcus sine of its numeric argument</span></li><li><span class="refentrytitle"><a href="#ref_at">at()</a></span><span class="refpurpose"> &#8212; can be used in the commands <code class="function">print</code> and input to place the output at a specified position</span></li><li><span class="refentrytitle"><a href="#ref_atan">atan()</a></span><span class="refpurpose"> &#8212; returns the arctangent of its numeric argument</span></li></ul></li><li><span class="section"><a href="#ref_b">B</a></span><ul><li><span class="refentrytitle"><a href="#ref_backcolor">backcolor</a></span><span class="refpurpose"> &#8212; change color for background of graphic window</span></li><li><span class="refentrytitle"><a href="#ref_beep">beep</a></span><span class="refpurpose"> &#8212; ring the bell within your computer; a synonym for <code class="function">bell</code></span></li><li><span class="refentrytitle"><a href="#ref_bell">bell</a></span><span class="refpurpose"> &#8212; ring the bell within your computer (just as <code class="function">beep</code>)</span></li><li><span class="refentrytitle"><a href="#ref_bin">bin$()</a></span><span class="refpurpose"> &#8212; converts a number into a sequence of binary digits</span></li><li><span class="refentrytitle"><a href="#ref_bind">bind()</a></span><span class="refpurpose"> &#8212; binds a <span class="application">yabasic</span>-program and the <span class="application">yabasic</span>-interpreter together into a <span class="emphasis"><em>standalone</em></span> program</span></li><li><span class="refentrytitle"><a href="#ref_bitnot">bitnot()</a></span><span class="refpurpose"> &#8212; the bitwise arithmetic <code class="function">not</code></span></li><li><span class="refentrytitle"><a href="#ref_box">box</a></span><span class="refpurpose"> &#8212; draw a rectangle. A synonym for <code class="function">rectangle</code></span></li><li><span class="refentrytitle"><a href="#ref_break">break</a></span><span class="refpurpose"> &#8212; breaks out of one or more loops or switch statements</span></li></ul></li><li><span class="section"><a href="#ref_c">C</a></span><ul><li><span class="refentrytitle"><a href="#ref_case">case</a></span><span class="refpurpose"> &#8212; mark the different cases within a switch-statement</span></li><li><span class="refentrytitle"><a href="#ref_ceil">ceil()</a></span><span class="refpurpose"> &#8212; compute the ceiling for its (float) argument</span></li><li><span class="refentrytitle"><a href="#ref_chomp">chomp$()</a></span><span class="refpurpose"> &#8212; remove a single trailing newline from its string-argument; if the string does not end in a newline, the string is returned unchanged</span></li><li><span class="refentrytitle"><a href="#ref_chr">chr$()</a></span><span class="refpurpose"> &#8212; accepts a number and returns the character at this position within the <abbr class="acronym">ascii</abbr> charset</span></li><li><span class="refentrytitle"><a href="#ref_circle">circle</a></span><span class="refpurpose"> &#8212; draws a circle in the graphic-window</span></li><li><span class="refentrytitle"><a href="#ref_clear">clear</a></span><span class="refpurpose"> &#8212; erase <code class="function">circle</code>s, <code class="function">rectangle</code>s or <code class="function">triangle</code>s</span></li><li><span class="refentrytitle"><a href="#ref_clear_screen">clear screen</a></span><span class="refpurpose"> &#8212; erases the text window</span></li><li><span class="refentrytitle"><a href="#ref_clear_window">clear window</a></span><span class="refpurpose"> &#8212; clear the graphic window and begin a new page, if printing is under way</span></li><li><span class="refentrytitle"><a href="#ref_close">close</a></span><span class="refpurpose"> &#8212; close a file, which has been opened before</span></li><li><span class="refentrytitle"><a href="#ref_close_curve">close curve</a></span><span class="refpurpose"> &#8212; close a curve, that has been drawn by the <code class="function">line</code>-command</span></li><li><span class="refentrytitle"><a href="#ref_close_printer">close printer</a></span><span class="refpurpose"> &#8212; stops printing of graphics</span></li><li><span class="refentrytitle"><a href="#ref_close_window">close window</a></span><span class="refpurpose"> &#8212; close the graphics-window</span></li><li><span class="refentrytitle"><a href="#ref_color">color</a></span><span class="refpurpose"> &#8212; change color for any subsequent drawing-command</span></li><li><span class="refentrytitle"><a href="#ref_compile">compile</a></span><span class="refpurpose"> &#8212; compile a string with <abbr class="acronym">yabasic</abbr>-code <span class="emphasis"><em>on the fly</em></span></span></li><li><span class="refentrytitle"><a href="#ref_continue">continue</a></span><span class="refpurpose"> &#8212; start the next iteration of a <code class="function">for</code>-, <code class="function">do</code>-, <code class="function">repeat</code>- or <code class="function">while</code>-loop</span></li><li><span class="refentrytitle"><a href="#ref_cos">cos()</a></span><span class="refpurpose"> &#8212; return the cosine of its single argument</span></li></ul></li><li><span class="section"><a href="#ref_d">D</a></span><ul><li><span class="refentrytitle"><a href="#ref_data">data</a></span><span class="refpurpose"> &#8212; introduces a list of data-items</span></li><li><span class="refentrytitle"><a href="#ref_date">date$</a></span><span class="refpurpose"> &#8212; returns a string with various components of the current date</span></li><li><span class="refentrytitle"><a href="#ref_dec">dec()</a></span><span class="refpurpose"> &#8212; convert a base 2 or base 16 number into decimal form</span></li><li><span class="refentrytitle"><a href="#ref_default">default</a></span><span class="refpurpose"> &#8212; mark the <span class="emphasis"><em>default</em></span>-branch within a switch-statement</span></li><li><span class="refentrytitle"><a href="#ref_dim">dim</a></span><span class="refpurpose"> &#8212; create an array prior to its first use</span></li><li><span class="refentrytitle"><a href="#ref_do">do</a></span><span class="refpurpose"> &#8212; start a (conditionless) <code class="function">do-loop</code></span></li><li><span class="refentrytitle"><a href="#ref_doc">doc</a></span><span class="refpurpose"> &#8212; special comment, which might be retrieved by the program itself</span></li><li><span class="refentrytitle"><a href="#ref_docu">docu$</a></span><span class="refpurpose"> &#8212; special array, containing the contents of all docu-statement within the program</span></li><li><span class="refentrytitle"><a href="#ref_dot">dot</a></span><span class="refpurpose"> &#8212; draw a dot in the graphic-window</span></li></ul></li><li><span class="section"><a href="#ref_e">E</a></span><ul><li><span class="refentrytitle"><a href="#ref_else">else</a></span><span class="refpurpose"> &#8212; mark an alternative within an <code class="function">if</code>-statement</span></li><li><span class="refentrytitle"><a href="#ref_elsif">elsif</a></span><span class="refpurpose"> &#8212; starts an alternate condition within an <code class="function">if</code>-statement</span></li><li><span class="refentrytitle"><a href="#ref_end">end</a></span><span class="refpurpose"> &#8212; terminate your program</span></li><li><span class="refentrytitle"><a href="#ref_endif">endif</a></span><span class="refpurpose"> &#8212; ends an <code class="function">if</code>-statement</span></li><li><span class="refentrytitle"><a href="#ref_end_sub">end sub</a></span><span class="refpurpose"> &#8212; ends a subroutine definition</span></li><li><span class="refentrytitle"><a href="#ref_eof">eof</a></span><span class="refpurpose"> &#8212; check, if an open file contains data</span></li><li><span class="refentrytitle"><a href="#ref_eor">eor()</a></span><span class="refpurpose"> &#8212; compute the bitwise <span class="emphasis"><em>exclusive or</em></span> of its two arguments</span></li><li><span class="refentrytitle"><a href="#ref_error">error</a></span><span class="refpurpose"> &#8212; raise an error and terminate your program</span></li><li><span class="refentrytitle"><a href="#ref_euler">euler</a></span><span class="refpurpose"> &#8212; another name for the constant <code class="function">2.71828182864</code></span></li><li><span class="refentrytitle"><a href="#ref_eval">eval()</a></span><span class="refpurpose"> &#8212; compile and execute a single numeric expression</span></li><li><span class="refentrytitle"><a href="#ref_eval2">eval$()</a></span><span class="refpurpose"> &#8212; compile and execute a single string-expression</span></li><li><span class="refentrytitle"><a href="#ref_execute">execute()</a></span><span class="refpurpose"> &#8212; execute a user defined subroutine, which must return a number</span></li><li><span class="refentrytitle"><a href="#ref_execute2">execute$()</a></span><span class="refpurpose"> &#8212; execute a user defined subroutine, which must return a string</span></li><li><span class="refentrytitle"><a href="#ref_exit">exit</a></span><span class="refpurpose"> &#8212; terminate your program</span></li><li><span class="refentrytitle"><a href="#ref_exp">exp()</a></span><span class="refpurpose"> &#8212; compute the exponential function of its single argument</span></li><li><span class="refentrytitle"><a href="#ref_export">export</a></span><span class="refpurpose"> &#8212; mark a function as globally visible</span></li></ul></li><li><span class="section"><a href="#ref_f">F</a></span><ul><li><span class="refentrytitle"><a href="#ref_false">false</a></span><span class="refpurpose"> &#8212; a constant with the value of 0</span></li><li><span class="refentrytitle"><a href="#ref_fi">fi</a></span><span class="refpurpose"> &#8212; another name for endif</span></li><li><span class="refentrytitle"><a href="#ref_fill">fill</a></span><span class="refpurpose"> &#8212; draw a filled <code class="function">circle</code>s, <code class="function">rectangle</code>s or <code class="function">triangle</code>s</span></li><li><span class="refentrytitle"><a href="#ref_floor">floor()</a></span><span class="refpurpose"> &#8212; compute the floor for its (float) argument</span></li><li><span class="refentrytitle"><a href="#ref_for">for</a></span><span class="refpurpose"> &#8212; starts a <code class="function">for</code>-loop</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_alloc">foreign_buffer_alloc$()</a></span><span class="refpurpose"> &#8212; Create a new buffer for use in a foreign function call</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_dump">foreign_buffer_dump$()</a></span><span class="refpurpose"> &#8212; return the content of a buffer as a hex-encoded string</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_free">foreign_buffer_free</a></span><span class="refpurpose"> &#8212; free a foreign buffer</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_get">foreign_buffer_get()</a></span><span class="refpurpose"> &#8212; extract a number from a foreign buffer</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_get2">foreign_buffer_get$()</a></span><span class="refpurpose"> &#8212; extract a string from a foreign buffer</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_get_buffer">foreign_buffer_get_buffer$()</a></span><span class="refpurpose"> &#8212; take a buffer and construct a handle to a second buffer from its content</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_set">foreign_buffer_set</a></span><span class="refpurpose"> &#8212; store a given value within a buffer</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_set_buffer">foreign_buffer_set_buffer</a></span><span class="refpurpose"> &#8212; store a pointer to one buffer within another buffer</span></li><li><span class="refentrytitle"><a href="#ref_foreign_buffer_size">foreign_buffer_size()</a></span><span class="refpurpose"> &#8212; return the size of the foreign buffer</span></li><li><span class="refentrytitle"><a href="#ref_foreign_function_call">foreign_function_call()</a></span><span class="refpurpose"> &#8212; call a function (returning a number) from a non-<span class="application">yabasic</span> library or dll</span></li><li><span class="refentrytitle"><a href="#ref_foreign_function_call2">foreign_function_call$()</a></span><span class="refpurpose"> &#8212; call a function (returning a string or a buffer) from a non-<span class="application">yabasic</span> library or dll</span></li><li><span class="refentrytitle"><a href="#ref_foreign_function_size">foreign_function_size()</a></span><span class="refpurpose"> &#8212; return the size of one of the types available for foreign function calls</span></li><li><span class="refentrytitle"><a href="#ref_frn">frnbf_ and frnfn_</a></span><span class="refpurpose"> &#8212; Abbreviations for <code class="literal">foreign_buffer_</code> and <code class="literal">foreign_function_</code></span></li><li><span class="refentrytitle"><a href="#ref_frac">frac()</a></span><span class="refpurpose"> &#8212; return the fractional part of its numeric argument</span></li></ul></li><li><span class="section"><a href="#ref_g">G</a></span><ul><li><span class="refentrytitle"><a href="#ref_getbit">getbit$()</a></span><span class="refpurpose"> &#8212; return a string representing the bit pattern of a rectangle within the graphic window</span></li><li><span class="refentrytitle"><a href="#ref_getscreen">getscreen$()</a></span><span class="refpurpose"> &#8212; returns a string representing a rectangular section of the text terminal</span></li><li><span class="refentrytitle"><a href="#ref_glob">glob()</a></span><span class="refpurpose"> &#8212; check if a string matches a simple pattern</span></li><li><span class="refentrytitle"><a href="#ref_gosub">gosub</a></span><span class="refpurpose"> &#8212; continue execution at another point within your program (and return later)</span></li><li><span class="refentrytitle"><a href="#ref_goto">goto</a></span><span class="refpurpose"> &#8212; continue execution at another point within your program (and never come back)</span></li></ul></li><li><span class="section"><a href="#ref_h">H</a></span><ul><li><span class="refentrytitle"><a href="#ref_hex">hex$()</a></span><span class="refpurpose"> &#8212; convert a number into hexadecimal</span></li></ul></li><li><span class="section"><a href="#ref_i">I</a></span><ul><li><span class="refentrytitle"><a href="#ref_if">if</a></span><span class="refpurpose"> &#8212; evaluate a condition and execute statements or not, depending on the result</span></li><li><span class="refentrytitle"><a href="#ref_import">import</a></span><span class="refpurpose"> &#8212; import a library</span></li><li><span class="refentrytitle"><a href="#ref_inkey">inkey$</a></span><span class="refpurpose"> &#8212; wait, until a key is pressed</span></li><li><span class="refentrytitle"><a href="#ref_input">input</a></span><span class="refpurpose"> &#8212; read input from user or  file and assign it to a variable</span></li><li><span class="refentrytitle"><a href="#ref_instr">instr()</a></span><span class="refpurpose"> &#8212; searches its second argument within the first; returns its position if found</span></li><li><span class="refentrytitle"><a href="#ref_int">int()</a></span><span class="refpurpose"> &#8212; return the integer part of its single numeric argument</span></li></ul></li><li><span class="section"><a href="#ref_l">L</a></span><ul><li><span class="refentrytitle"><a href="#ref_label">label</a></span><span class="refpurpose"> &#8212; mark a specific location within your program for <code class="function">goto</code>, <code class="function">gosub</code> or <code class="function">restore</code></span></li><li><span class="refentrytitle"><a href="#ref_left">left$()</a></span><span class="refpurpose"> &#8212; return (<span class="emphasis"><em>or change</em></span>) left end of a string</span></li><li><span class="refentrytitle"><a href="#ref_len">len()</a></span><span class="refpurpose"> &#8212; return the length of a string</span></li><li><span class="refentrytitle"><a href="#ref_line">line</a></span><span class="refpurpose"> &#8212; draw a line</span></li><li><span class="refentrytitle"><a href="#ref_line_input">line input</a></span><span class="refpurpose"> &#8212; read in a whole line of text and assign it to a variable</span></li><li><span class="refentrytitle"><a href="#ref_local">local</a></span><span class="refpurpose"> &#8212; mark a variable as local to a subroutine</span></li><li><span class="refentrytitle"><a href="#ref_log">log()</a></span><span class="refpurpose"> &#8212; compute the natural logarithm</span></li><li><span class="refentrytitle"><a href="#ref_loop">loop</a></span><span class="refpurpose"> &#8212; marks the end of an infinite loop</span></li><li><span class="refentrytitle"><a href="#ref_lower">lower$()</a></span><span class="refpurpose"> &#8212; convert a string to lower case</span></li><li><span class="refentrytitle"><a href="#ref_ltrim">ltrim$()</a></span><span class="refpurpose"> &#8212; trim spaces at the left end of a string</span></li></ul></li><li><span class="section"><a href="#ref_m">M</a></span><ul><li><span class="refentrytitle"><a href="#ref_max">max()</a></span><span class="refpurpose"> &#8212; return the larger of its two arguments</span></li><li><span class="refentrytitle"><a href="#ref_mid">mid$()</a></span><span class="refpurpose"> &#8212; return (<span class="emphasis"><em>or change</em></span>) characters from within a string</span></li><li><span class="refentrytitle"><a href="#ref_min">min()</a></span><span class="refpurpose"> &#8212; return the smaller of its two arguments</span></li><li><span class="refentrytitle"><a href="#ref_mod">mod</a></span><span class="refpurpose"> &#8212; compute the remainder of a division</span></li><li><span class="refentrytitle"><a href="#ref_mouseb">mouseb</a></span><span class="refpurpose"> &#8212; extract the state of the mousebuttons from a string returned by <code class="function">inkey$</code></span></li><li><span class="refentrytitle"><a href="#ref_mousemod">mousemod</a></span><span class="refpurpose"> &#8212; return the state of the modifier keys during a mouseclick</span></li><li><span class="refentrytitle"><a href="#ref_mousex">mousex</a></span><span class="refpurpose"> &#8212; return the x-position of a mouseclick</span></li><li><span class="refentrytitle"><a href="#ref_mousey">mousey</a></span><span class="refpurpose"> &#8212; return the y-position of a mouseclick</span></li></ul></li><li><span class="section"><a href="#ref_n">N</a></span><ul><li><span class="refentrytitle"><a href="#ref_new_curve">new curve</a></span><span class="refpurpose"> &#8212; start a new curve, that will be drawn with the <code class="function">line</code>-command</span></li><li><span class="refentrytitle"><a href="#ref_next">next</a></span><span class="refpurpose"> &#8212; mark the end of a for loop</span></li><li><span class="refentrytitle"><a href="#ref_logical_not">not</a></span><span class="refpurpose"> &#8212; negate a logical expression; can be written as <code class="function">!</code></span></li><li><span class="refentrytitle"><a href="#ref_numparams">numparams</a></span><span class="refpurpose"> &#8212; return the number of parameters, that have been passed to a subroutine</span></li></ul></li><li><span class="section"><a href="#ref_o">O</a></span><ul><li><span class="refentrytitle"><a href="#ref_on_gosub">on gosub</a></span><span class="refpurpose"> &#8212; jump to one of multiple <code class="function">gosub</code>-targets</span></li><li><span class="refentrytitle"><a href="#ref_on_goto">on goto</a></span><span class="refpurpose"> &#8212; jump to one of many <code class="function">goto</code>-targets</span></li><li><span class="refentrytitle"><a href="#ref_on_interrupt">on interrupt</a></span><span class="refpurpose"> &#8212; change reaction on keyboard interrupts</span></li><li><span class="refentrytitle"><a href="#ref_open">open</a></span><span class="refpurpose"> &#8212; open a file</span></li><li><span class="refentrytitle"><a href="#ref_open_printer">open printer</a></span><span class="refpurpose"> &#8212; open printer for printing graphics</span></li><li><span class="refentrytitle"><a href="#ref_open_window">open window</a></span><span class="refpurpose"> &#8212; open a graphic window</span></li><li><span class="refentrytitle"><a href="#ref_logical_or">logical or</a></span><span class="refpurpose"> &#8212; logical or, used in conditions</span></li><li><span class="refentrytitle"><a href="#ref_bitwise_or">or()</a></span><span class="refpurpose"> &#8212; arithmetic or, used for bit-operations</span></li></ul></li><li><span class="section"><a href="#ref_p">P</a></span><ul><li><span class="refentrytitle"><a href="#ref_pause">pause</a></span><span class="refpurpose"> &#8212; pause, sleep, wait for the specified number of seconds</span></li><li><span class="refentrytitle"><a href="#ref_peek">peek</a></span><span class="refpurpose"> &#8212; retrieve various internal informations (numeric)</span></li><li><span class="refentrytitle"><a href="#ref_peek2">peek$</a></span><span class="refpurpose"> &#8212; retrieve various internal informations (strings)</span></li><li><span class="refentrytitle"><a href="#ref_pi">pi</a></span><span class="refpurpose"> &#8212; a constant with the value <code class="computeroutput">3.14159</code></span></li><li><span class="refentrytitle"><a href="#ref_poke">poke</a></span><span class="refpurpose"> &#8212; change selected internals of <span class="application">yabasic</span></span></li><li><span class="refentrytitle"><a href="#ref_print">print</a></span><span class="refpurpose"> &#8212; Write to terminal or file</span></li><li><span class="refentrytitle"><a href="#ref_print_color">print or input with color</a></span><span class="refpurpose"> &#8212; print or input-prompt with color</span></li><li><span class="refentrytitle"><a href="#ref_print_colour">print colour</a></span><span class="refpurpose"> &#8212; see <code class="function">print color</code></span></li><li><span class="refentrytitle"><a href="#ref_putbit">putbit</a></span><span class="refpurpose"> &#8212; draw a rectangle of pixels encoded within a string into the graphics window</span></li><li><span class="refentrytitle"><a href="#ref_putscreen">putscreen</a></span><span class="refpurpose"> &#8212; draw a rectangle of characters into the text terminal</span></li></ul></li><li><span class="section"><a href="#ref_r">R</a></span><ul><li><span class="refentrytitle"><a href="#ref_ran">ran()</a></span><span class="refpurpose"> &#8212; return a random number</span></li><li><span class="refentrytitle"><a href="#ref_read">read</a></span><span class="refpurpose"> &#8212; read data from <code class="function">data</code>-statements</span></li><li><span class="refentrytitle"><a href="#ref_rectangle">rectangle</a></span><span class="refpurpose"> &#8212; draw a rectangle</span></li><li><span class="refentrytitle"><a href="#ref_redim">redim</a></span><span class="refpurpose"> &#8212; create an array prior to its first use. A synonym for <code class="function">dim</code></span></li><li><span class="refentrytitle"><a href="#ref_rem">rem</a></span><span class="refpurpose"> &#8212; start a comment</span></li><li><span class="refentrytitle"><a href="#ref_repeat">repeat</a></span><span class="refpurpose"> &#8212; start a <code class="function">repeat</code>-loop</span></li><li><span class="refentrytitle"><a href="#ref_restore">restore</a></span><span class="refpurpose"> &#8212; reposition the <code class="function">data</code>-pointer</span></li><li><span class="refentrytitle"><a href="#ref_return">return</a></span><span class="refpurpose"> &#8212; return from a subroutine or a gosub</span></li><li><span class="refentrytitle"><a href="#ref_reverse">reverse</a></span><span class="refpurpose"> &#8212; print reverse (background and foreground colors exchanged)</span></li><li><span class="refentrytitle"><a href="#ref_right">right$()</a></span><span class="refpurpose"> &#8212; return (<span class="emphasis"><em>or change</em></span>) the right end of a string</span></li><li><span class="refentrytitle"><a href="#ref_rinstr">rinstr()</a></span><span class="refpurpose"> &#8212; find the rightmost occurrence of one string within the other</span></li><li><span class="refentrytitle"><a href="#ref_round">round()</a></span><span class="refpurpose"> &#8212; round its argument to the nearest integer</span></li><li><span class="refentrytitle"><a href="#ref_rtrim">rtrim$()</a></span><span class="refpurpose"> &#8212; trim spaces at the right end of a string</span></li></ul></li><li><span class="section"><a href="#ref_s">S</a></span><ul><li><span class="refentrytitle"><a href="#ref_screen">screen</a></span><span class="refpurpose"> &#8212; as <code class="function">clear screen</code> clears the text window</span></li><li><span class="refentrytitle"><a href="#ref_seek">seek()</a></span><span class="refpurpose"> &#8212; change the position within an open file</span></li><li><span class="refentrytitle"><a href="#ref_sig">sig()</a></span><span class="refpurpose"> &#8212; return the sign of its argument</span></li><li><span class="refentrytitle"><a href="#ref_sin">sin()</a></span><span class="refpurpose"> &#8212; return the sine of its single argument</span></li><li><span class="refentrytitle"><a href="#ref_shl">shl()</a></span><span class="refpurpose"> &#8212; shift its argument bitwise to the left</span></li><li><span class="refentrytitle"><a href="#ref_shr">shr()</a></span><span class="refpurpose"> &#8212; shift its argument bitwise to the right</span></li><li><span class="refentrytitle"><a href="#ref_sleep">sleep</a></span><span class="refpurpose"> &#8212; pause, sleep, wait for the specified number of seconds</span></li><li><span class="refentrytitle"><a href="#ref_split">split()</a></span><span class="refpurpose"> &#8212; split a string into many strings</span></li><li><span class="refentrytitle"><a href="#ref_sqr">sqr()</a></span><span class="refpurpose"> &#8212; compute the square of its argument</span></li><li><span class="refentrytitle"><a href="#ref_sqrt">sqrt()</a></span><span class="refpurpose"> &#8212; compute the square root of its argument</span></li><li><span class="refentrytitle"><a href="#ref_static">static</a></span><span class="refpurpose"> &#8212; preserves the value of a variable between calls to a subroutine</span></li><li><span class="refentrytitle"><a href="#ref_step">step</a></span><span class="refpurpose"> &#8212; specifies the increment step in a for-loop</span></li><li><span class="refentrytitle"><a href="#ref_str">str$()</a></span><span class="refpurpose"> &#8212; convert a number into a string</span></li><li><span class="refentrytitle"><a href="#ref_string">string$()</a></span><span class="refpurpose"> &#8212; create a new string by repeating the given one a certain number of times</span></li><li><span class="refentrytitle"><a href="#ref_sub">sub</a></span><span class="refpurpose"> &#8212; declare a user defined subroutine</span></li><li><span class="refentrytitle"><a href="#ref_switch">switch</a></span><span class="refpurpose"> &#8212; select one of many alternatives depending on a value</span></li><li><span class="refentrytitle"><a href="#ref_system">system()</a></span><span class="refpurpose"> &#8212; hand the name of an external command over to your operating system and return its exitcode</span></li><li><span class="refentrytitle"><a href="#ref_system2">system$()</a></span><span class="refpurpose"> &#8212; hand the name of an external command over to your operating system and return its output</span></li></ul></li><li><span class="section"><a href="#ref_t">T</a></span><ul><li><span class="refentrytitle"><a href="#ref_tan">tan()</a></span><span class="refpurpose"> &#8212; return the tangent of its argument</span></li><li><span class="refentrytitle"><a href="#ref_tell">tell</a></span><span class="refpurpose"> &#8212; get the current position within an open file</span></li><li><span class="refentrytitle"><a href="#ref_text">text</a></span><span class="refpurpose"> &#8212; write text into your graphic-window</span></li><li><span class="refentrytitle"><a href="#ref_then">then</a></span><span class="refpurpose"> &#8212; tell the long from the short form of the <code class="function">if</code>-statement</span></li><li><span class="refentrytitle"><a href="#ref_time">time$</a></span><span class="refpurpose"> &#8212; return a string containing the current time</span></li><li><span class="refentrytitle"><a href="#ref_to">to</a></span><span class="refpurpose"> &#8212; this keyword appears as part of other statements</span></li><li><span class="refentrytitle"><a href="#ref_token">token()</a></span><span class="refpurpose"> &#8212; split a string into multiple strings</span></li><li><span class="refentrytitle"><a href="#ref_triangle">triangle</a></span><span class="refpurpose"> &#8212; draw a triangle</span></li><li><span class="refentrytitle"><a href="#ref_trim">trim$()</a></span><span class="refpurpose"> &#8212; remove leading and trailing spaces from its argument</span></li><li><span class="refentrytitle"><a href="#ref_true">true</a></span><span class="refpurpose"> &#8212; a constant with the value of 1</span></li></ul></li><li><span class="section"><a href="#ref_u">U</a></span><ul><li><span class="refentrytitle"><a href="#ref_until">until</a></span><span class="refpurpose"> &#8212; end a <code class="function">repeat</code>-loop</span></li><li><span class="refentrytitle"><a href="#ref_upper">upper$()</a></span><span class="refpurpose"> &#8212; convert a string to upper case</span></li><li><span class="refentrytitle"><a href="#ref_using">using</a></span><span class="refpurpose"> &#8212; Specify the format for printing a number</span></li></ul></li><li><span class="section"><a href="#ref_v">V</a></span><ul><li><span class="refentrytitle"><a href="#ref_val">val()</a></span><span class="refpurpose"> &#8212; converts a string to a number</span></li></ul></li><li><span class="section"><a href="#ref_w">W</a></span><ul><li><span class="refentrytitle"><a href="#ref_wait">wait</a></span><span class="refpurpose"> &#8212; pause, sleep, wait for the specified number of seconds</span></li><li><span class="refentrytitle"><a href="#ref_wend">wend</a></span><span class="refpurpose"> &#8212; end a while-loop</span></li><li><span class="refentrytitle"><a href="#ref_while">while</a></span><span class="refpurpose"> &#8212; start a <code class="function">while</code>-loop</span></li><li><span class="refentrytitle"><a href="#ref_origin">window origin</a></span><span class="refpurpose"> &#8212; move the origin of a window</span></li></ul></li><li><span class="section"><a href="#ref_x">X</a></span><ul><li><span class="refentrytitle"><a href="#ref_xor">xor()</a></span><span class="refpurpose"> &#8212; compute the exclusive or</span></li></ul></li><li><span class="section"><a href="#ref_special_characters">Symbols and Special characters</a></span><ul><li><span class="refentrytitle"><a href="#ref_hash">#</a></span><span class="refpurpose"> &#8212; either a comment or a marker for a file-number</span></li><li><span class="refentrytitle"><a href="#ref_double_slash">//</a></span><span class="refpurpose"> &#8212; starts a comment</span></li><li><span class="refentrytitle"><a href="#ref_at_sign">@</a></span><span class="refpurpose"> &#8212; synonymous to at</span></li><li><span class="refentrytitle"><a href="#ref_colon">:</a></span><span class="refpurpose"> &#8212; separate commands from each other</span></li><li><span class="refentrytitle"><a href="#ref_semicolon">;</a></span><span class="refpurpose"> &#8212; suppress the implicit newline after a print-statement</span></li><li><span class="refentrytitle"><a href="#ref_pow">** or ^</a></span><span class="refpurpose"> &#8212; raise its first argument to the power of its second</span></li><li><span class="refentrytitle"><a href="#ref_comparison">&lt; &lt;= &gt; &gt;= = == &lt;&gt; !=</a></span><span class="refpurpose"> &#8212; Compare numbers or strings</span></li></ul></li></ul></div>
  

    <section class="section" id="ref_a"><div class="titlepage"><div><div><h2 class="title" style="clear: both">A</h2></div></div></div>
      

      <div class="refentry" id="ref_abs"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  abs()
	   &#8212; returns the absolute value of its numeric argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">y=abs(x)</pre>
	</div>
	<div class="refsection" id="id3426"><h2>Description</h2>
	  
	  <p>If the argument of the <code class="function">abs</code>-function is positive (e.g. 2) it is returned unchanged, if the argument is negative (e.g. -1) it is returned as a positive value (e.g. 1).</p>
	</div>
	<div class="refsection" id="id3432"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print abs(-2),abs(2)
          </pre>
	    <p>This example will print <code class="computeroutput">2 2</code></p>
	  </div>
	</div>
	<div class="refsection" id="id3440"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_sig" title="sig()"><code class="function">sig</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_acos"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  acos()
	   &#8212; returns the arcus cosine of its numeric argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">x=acos(angle)</pre>
	</div>
	<div class="refsection" id="id3455"><h2>Description</h2>
	  
	  <p><code class="function">acos</code> is the arcus cosine-function, i.e. the inverse of the <a class="link" href="#ref_cos" title="cos()"><code class="function">cos</code></a>-function. Or, more elaborate: It Returns the angle (in radians, not degrees !), which, fed to the cosine-function will produce the argument passed to the <code class="function">acos</code>-function.</p>
	</div>
	<div class="refsection" id="id3464"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print acos(0.5),acos(cos(pi))
          </pre>
	    <p>This example will print <code class="computeroutput">1.0472 3.14159</code> which are &#960;/3 and &#960; respectively.</p>
	  </div>
	</div>
	<div class="refsection" id="id3472"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_cos" title="cos()"><code class="function">cos</code></a>, <a class="link" href="#ref_asin" title="asin()"><code class="function">asin</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_logical_and"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  and
	   &#8212; logical and, used in conditions
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
if a and b &#8230;
while a and b &#8230;
</pre>
	</div>
	<div class="refsection" id="id3489"><h2>Description</h2>
	  
	  <p>Used in conditions (e.g within <code class="function"><a class="link" href="#ref_if" title="if">if</a></code>, <code class="function"><a class="link" href="#ref_while" title="while">while</a></code> or <code class="function"><a class="link" href="#ref_until" title="until">until</a></code>) to join two expressions. Returns <code class="constant">true</code>, if and only if its left and right argument are both <code class="constant">true</code> and <code class="constant">false</code> otherwise.</p>
	  <p>Note, that
	  <a class="link" href="#ref_logical_shortcuts" title="Logical shortcuts"><span class="emphasis"><em>logical shortcuts</em></span></a> may take place.</p>
	</div>
	<div class="refsection" id="id3506"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a number" a
if (a&gt;=1 and a&lt;=9) print "your input is between 1 and 9"
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id3512"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_logical_or" title="logical or"><code class="function">or</code></a>,<a class="link" href="#ref_logical_not" title="not"><code class="function">not</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_bitwise_and"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  and()
	   &#8212; the bitwise arithmetic <code class="function">and</code>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
x=and(a,b)
</pre>
	</div>
	<div class="refsection" id="id3530"><h2>Description</h2>
	  
	  <p>Used to compute the bitwise <code class="function">and</code> of both its argument. Both arguments are treated as binary numbers (i.e. a sequence of digits 0 and 1); a bit of the resulting value will then be 1, if both arguments have a 1 at this position in their binary representation.</p>
	  <p>Note, that both arguments are silently converted to integer values and that negative numbers have their own binary representation and may lead to unexpected results when passed to <code class="function">and</code>.</p>
	</div>
	<div class="refsection" id="id3538"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print and(6,3)
          </pre>
	    <p>This will print <code class="computeroutput">2</code>. This result is clear, if you note, that the binary representation of 6 and 3 are 110 and 011 respectively; this will yield 010 in binary representation or 2 as decimal.</p>
	  </div>
	</div>
	<div class="refsection" id="id3546"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_bitwise_or" title="or()"><code class="function">or</code></a>, <a class="link" href="#ref_eor" title="eor()"><code class="function">eor</code></a> and <a class="link" href="#ref_bitnot" title="bitnot()"><code class="function">bitnot</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_arraydim"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  arraydim()
	   &#8212; returns the dimension of the array, which is passed as an <a class="link" href="#ref_array_references" title="References on arrays">array reference</a> 
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">a=arraydim(b())</pre>
	</div>
	<div class="refsection" id="id3566"><h2>Description</h2>
	  
	  <p>If you apply the <code class="literal">arraydim()</code>-function on a one-dimensional array (i.e. a vector) it will return <code class="computeroutput">1</code>, on a two-dimensional array (i.e. a matrix) it will return 2, and so on.</p>
	  <p>This is mostly used within subroutines, which expect an array among their parameters. Such subroutines tend to use the <code class="function">arraydim</code>-function to check, if the array which has been passed, has the right dimension. E.g. a subroutine to multiply two matrices may want to check, if it really is invoked with two 2-dimensional arrays.</p>
	</div>
	<div class="refsection" id="id3575"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
dim a(10,10),b(10)
print arraydim(a()),arraydim(b())
          </pre>
	    <p>This will print <code class="computeroutput">2 1</code>, which are the dimension of the arrays <code class="literal">a()</code> and <code class="literal">b()</code>. You may check out the function <a class="link" href="#ref_arraysize" title="arraysize()"><code class="function">arraysize</code></a> for a full example.</p>
	  </div>
	</div>
	<div class="refsection" id="id3587"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_arraysize" title="arraysize()"><code class="function">arraysize</code></a> and <a class="link" href="#ref_dim" title="dim"><code class="function">dim</code></a>.</p>
	</div>
      </div>

      <div class="refentry" id="ref_arraysize"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  arraysize()
	   &#8212; returns the size of a dimension of an array
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">x=arraysize(a(),b)</pre>
	</div>
	<div class="refsection" id="id3604"><h2>Description</h2>
	  
	  <p>The <code class="function">arraysize</code>-function computes the size of the specified dimension of a given array. Here, <span class="emphasis"><em>size</em></span> stands for the maximum number, that may be used as an index for this array. The first argument to this function must be an <a class="link" href="#ref_array_references" title="References on arrays">reference to an array</a>, the second one specifies, which of the multiple dimensions of the array should be taken to calculate the size. Please note, that <code class="function">arraysize</code> returns the value that has been used in the actual <code class="function">dim</code>-statement, the real (internal) size of the array is allocated <span class="emphasis"><em>one larger</em></span> in each dimension to have a first element at index 0; however this is <span class="emphasis"><em>not</em></span> reflected by the output of <code class="function">arraysize</code>.</p>
	  <p>An Example involving subroutines: Let's say, an array has been declared as <code class="literal">dim a(10,20)</code> (that is a two-dimensional array or a matrix). If this array is passed as an <a class="link" href="#ref_array_references" title="References on arrays">array reference</a> to a subroutine, this sub will not know, what sort of array has been passed. With the <code class="function">arraydim</code>-function the sub will be able to find the dimension of the array, with the <code class="function">arraysize</code>-function it will be able to find out the size of this array in its two dimensions, which will be 10 and 20 respectively.</p>
	  <p>Our sample array is two dimensional; if you envision it as a matrix this matrix has 10 lines and 20 columns (see the <code class="function">dim</code>-statement above. To state it more formally: The first dimension (lines) has a size of 10, the second dimension (columns) has a size of 20; these numbers are those returned by <code class="literal">arraysize(a(),1)</code> and <code class="literal">arraysize(a(),2)</code> respectively. Refer to the example below for a typical usage.</p>
	</div>
	<div class="refsection" id="id3626"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">

rem
rem  This program adds two matrices elementwise.
rem

dim a(10,20),b(10,20),c(10,20)

rem  initialization of the arrays a() and b() 
for y=1 to 10:for x=1 to 20
   a(y,x)=int(ran(4)):b(y,x)=int(ran(4))
next x:next y

matadd(a(),b(),c())

print "Result:"
for x=1 to 20
   for y=10 to 1 step -1
      print c(y,x)," ";
   next y
   print
next x

sub matadd(m1(),m2(),r())

   rem  This sub will add the matrices m1() and m2()
   rem  elementwise and store the result within r()
   rem  This is not very useful but easy to implement.
   rem  However, this sub excels in checking its arguments
   rem  with arraydim() and arraysize()

   local x:local y
   
   if (arraydim(m1())&lt;&gt;2 or arraydim(m2())&lt;&gt;2 or arraydim(r())&lt;&gt;2) then
      error "Need two dimensional arrays as input"
   endif

   y=arraysize(m1(),1):x=arraysize(m1(),2)
   if (arraysize(m2(),1)&lt;&gt;y or arraysize(m2(),2)&lt;&gt;x) then
      error "The two matrices cannot be added elementwise"
   endif

   if (arraysize(r(),1)&lt;&gt;y or arraysize(r(),2)&lt;&gt;x) then
      error "The result cannot be stored in the third argument"
   endif

   local xx:local yy
   for xx=1 to x
      for yy=1 to y
         r(yy,xx)=m1(yy,xx)+m2(yy,xx)
      next yy
   next xx

 end sub

          </pre>
	  </div>
	</div>
	<div class="refsection" id="id3632"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_arraydim" title="arraydim()"><code class="function">arraydim</code></a> and <a class="link" href="#ref_dim" title="dim"><code class="function">dim</code></a>.</p>
	</div>
      </div>

      <div class="refentry" id="ref_asc"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  asc()
	   &#8212; accepts a string and returns the position of its first character within the <abbr class="acronym">ascii</abbr> charset
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">a=asc(char$)</pre>
	</div>
	<div class="refsection" id="id3650"><h2>Description</h2>
	  
	  <p>The <code class="function">asc</code>-function accepts a string, takes its first character and looks it up within the <abbr class="acronym">ascii</abbr>-charset; this position will be returned. The <code class="function">asc</code>-function is the opposite of the <code class="function"><a class="link" href="#ref_chr" title="chr$()">chr$</a></code>-function. There are valid uses for <code class="function">asc</code>, however, comparing strings (i.e. to bring them into alphabetical sequence) is <span class="emphasis"><em>not</em></span> among them; in such many cases you might consider to compare strings directly with <code class="literal">&lt;</code>, <code class="literal">=</code> and <code class="literal">&gt;</code> (rather than converting a string to a number and comparing this number).</p>
	</div>
	<div class="refsection" id="id3665"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a letter between 'a' and 'y': " a$
if (a$&lt;"a" or a$&gt;"y") print a$," is not in the proper range":end
print "The letter after ",a$," is ",chr$(asc(a$)+1)
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id3671"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_chr" title="chr$()"><code class="function">chr$</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_asin"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  asin()
	   &#8212; returns the arcus sine of its numeric argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">angle=asin(x)</pre>
	</div>
	<div class="refsection" id="id3686"><h2>Description</h2>
	  
	  <p><code class="function">acos</code> is the arcus sine-function, i.e. the inverse of the <a class="link" href="#ref_sin" title="sin()"><code class="function">sin</code></a>-function. Or, more elaborate: It Returns the angle (in radians, not degrees !), which, fed to the sine-function will produce the argument passed to the <code class="function">asin</code>-function.</p>
	</div>
	<div class="refsection" id="id3695"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print asin(0.5),asin(sin(pi))
          </pre>
	    <p>This will print <code class="computeroutput">0.523599 -2.06823e-13</code> which is &#960;/6 and almost 0 respectively.</p>
	  </div>
	</div>
	<div class="refsection" id="id3703"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_sin" title="sin()"><code class="function">sin</code></a>, <a class="link" href="#ref_acos" title="acos()"><code class="function">acos</code></a></p> 
	</div>
      </div>

      <div class="refentry" id="ref_at"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  at()
	   &#8212; can be used in the commands <a class="link" href="#ref_print" title="print"><code class="function">print</code></a> and <code class="function"><a class="link" href="#ref_input" title="input">input</a></code> to place the output at a specified position
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
clear screen
&#8230;
print at(a,b)
input at(a,b) "Your input: " a$
print @(a,b)
</pre>
	</div>
	<div class="refsection" id="id3724"><h2>Description</h2>
	  
	  <p>The <code class="function">at</code>-clause takes two numeric arguments (e.g. <code class="literal">at(2,3)</code>) and can be inserted after the <code class="literal">print</code>-keyword. <code class="literal">at()</code> can be used only if <a class="link" href="#ref_clear_screen" title="clear screen"><code class="function">clear screen</code></a> has been executed at least once within the program (otherwise you will get an error).</p>
	  <p>The two numeric arguments of the <code class="function">at</code>-function may range from 0 to the width of your terminal minus 1, and from 0 to the height of your terminal minus 1; if any argument exceeds these values, it will be truncated accordingly. However, <span class="application">yabasic</span> has no influence on the size of your terminal (80x25 is a common, but not mandatory), the size of your terminal and the maximum values acceptable within the <code class="function">at</code>-clause may vary. To get the size of your terminal you may use the <a class="link" href="#ref_peek" title="peek"><code class="function">peek</code></a>-function: <code class="literal">peek("screenwidth")</code> returns the width of your terminal and <code class="literal">peek("screenheight")</code> its height.</p>
	</div>
	<div class="refsection" id="id3743"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
clear screen
maxx=peek("screenwidth")-1:maxy=peek("screenheight")-1
for x=0 to maxx
  print at(x,maxy*(0.5+sin(2*pi*x/maxx)/2)) "*"
next x
          </pre>
	    <p>This example plots a full period of the sine-function across the screen.</p>
	  </div>
	</div>
	<div class="refsection" id="id3750"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_print" title="print"><code class="function">print</code></a>, <a class="link" href="#ref_clear_screen" title="clear screen"><code class="function">clear screen</code></a>, <a class="link" href="#ref_print_color" title="print or input with color"><code class="function">color</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_atan"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  atan()
	   &#8212; returns the arctangent of its numeric argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
angle=atan(a,b)
angle=atan(a)
</pre>
	</div>
	<div class="refsection" id="id3769"><h2>Description</h2>
	  
	  <p><code class="function">atan</code> is the arctangent-function, i.e. the inverse of the <a class="link" href="#ref_tan" title="tan()"><code class="function">tan</code></a>-function. Or, more elaborate: It Returns the angle (in radians, not degrees !), which, fed to the <code class="function">tan</code>-function will produce the argument passed to the <code class="function">atan</code>-function.</p>
	  <p>The <code class="function">atan</code>-function has a second form, which accepts two arguments: <code class="function">atan(a,b)</code> which is (mostly) equivalent to <code class="function">atan(a/b)</code> <span class="emphasis"><em>except</em></span> for the fact, that the two-argument-form returns an angle in the range -&#960; to &#960;, whereas the one-argument-form returns an angle in the range -&#960;/2 to &#960;/2. To understand this you have to be good at math.</p>
	</div>
	<div class="refsection" id="id3784"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print atan(1),atan(tan(pi)),atan(-0,-1),atan(-0,1)
          </pre>
	    <p>This will print <code class="computeroutput">0.463648 2.06823e-13 -3.14159 3.14159</code> which is &#960;/4, almost 0, -&#960; and &#960; respectively.</p>
	  </div>
	</div>
	<div class="refsection" id="id3792"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_tan" title="tan()">tan</a></code>, <code class="function"><a class="link" href="#ref_sin" title="sin()">sin</a></code></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_b"><div class="titlepage"><div><div><h2 class="title" style="clear: both">B</h2></div></div></div>
      

      <div class="refentry" id="ref_backcolor"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  color
	   &#8212; change color for background of graphic window
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
backcolour red,green,blue
backcolour "red,green,blue"
	  </pre>
	</div>
	<div class="refsection" id="id3813"><h2>Description</h2>
	  
	  <p>Change the color, that becomes visible, if any portion of the window is erased, e.g. after <code class="function"><a class="link" href="#ref_clear_window" title="clear window">clear window</a></code> or <code class="function"><a class="link" href="#ref_clear" title="clear">clear line</a></code>. Note however, that parts of the window, that show the old background color will not change.</p>
	  <p>As with the <code class="function"><a class="link" href="#ref_color" title="color">color</a></code>-command, the new background color can either be specified as a triple of three numbers or as a single string, that contains those three numbers separated by commas.</p>
	  <p>Note, that the command <code class="function">backcolor</code> can be written as <code class="function">backcolour</code> too and vice versa.</p>
	</div>
	<div class="refsection" id="id3828"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 255,255
for x=10 to 235 step 10:for y=10 to 235 step 10
  	backcolour x,y,0
	clear window
	sleep 1
next y:next x
            </pre>
	    <p>This changes the background colour of the graphic window repeatedly and clears it every time, so that it is filled with the new background colour.</p>
	  </div>
	</div>
	<div class="refsection" id="id3835"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_open_window" title="open window">open window</a></code>, <code class="function"><a class="link" href="#ref_color" title="color">color</a></code>, <code class="function"><a class="link" href="#ref_line" title="line">line</a></code>, <code class="function"><a class="link" href="#ref_rectangle" title="rectangle">rectangle</a></code>, <code class="function"><a class="link" href="#ref_triangle" title="triangle">triangle</a></code>, <code class="function"><a class="link" href="#ref_circle" title="circle">circle</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_beep"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  beep
	   &#8212; ring the bell within your computer; a synonym for <code class="function">bell</code>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">beep</pre>
	</div>
	<div class="refsection" id="id3861"><h2>Description</h2>
	  
	  <p>The <code class="function">bell</code>-command rings the bell within your computer once. This command is <span class="emphasis"><em>not</em></span> a sound-interface, so you can neither vary the length or the height of the sound (technically, it just prints <code class="literal">\a</code>). <code class="function">bell</code> is exactly the same as <code class="function"><a class="link" href="#ref_beep" title="beep">beep</a></code>.</p>
	</div>
	<div class="refsection" id="id3872"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
beep:print "This is a problem ..."
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id3878"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_beep" title="beep">beep</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_bell"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  bell
	   &#8212; ring the bell within your computer (just as <code class="function">beep</code>)
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">bell</pre>
	</div>
	<div class="refsection" id="id3894"><h2>Description</h2>
	  
	  <p>The <code class="function">beep</code>-command rings the bell within your computer once. <code class="function">beep</code> is a synonym for <code class="function"><a class="link" href="#ref_bell" title="bell">bell</a></code>.</p>
	</div>
	<div class="refsection" id="id3903"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "This is a problem ...":beep
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id3909"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_bell" title="bell">bell</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_bin"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  bin$()
	   &#8212; converts a number into a sequence of binary digits
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">hexadecimal$=bin$(decimal)</pre>
	</div>
	<div class="refsection" id="id3924"><h2>Description</h2>
	  
	  <p>The <code class="function">bin$</code>-function takes a single numeric argument an converts it into a string of binary digits (i.e. zeroes and ones). If you pass a negative number to <code class="function">bin$</code>, the resulting string will be preceded by a '-'.</p>
	  <p>If you want to convert the other way around (i.e. from binary to decimal) you may use the <code class="function"><a class="link" href="#ref_dec" title="dec()">dec</a></code>-function.</p>
	</div>
	<div class="refsection" id="id3934"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=1 to 100
  print bin$(a)
next a
          </pre>
	    <p>This example prints the binary representation of all digits between 1 and 100.</p>
	  </div>
	</div>
	<div class="refsection" id="id3941"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_hex" title="hex$()">hex$</a></code>, <code class="function"><a class="link" href="#ref_dec" title="dec()">dec</a></code>, <a class="link" href="#top_numbers_with_base_2_or_16" title="Numbers with base 2 or 16">numbers with base 2 or 16</a>.</p>
	</div>
      </div>

      <div class="refentry" id="ref_bind"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  bind()
	   &#8212; binds a <span class="application">yabasic</span>-program and the <span class="application">yabasic</span>-interpreter together into a <span class="emphasis"><em>standalone</em></span> program
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">bind("foo.exe")</pre>
	</div>
	<div class="refsection" id="id3962"><h2>Description</h2>
	  
	  <p>The <code class="function">bind</code>-command combines your own <span class="application">yabasic</span>-program (plus all the libraries it does <code class="function">import</code>) and the interpreter by copying them into a new file, whose name is passed as an argument. This new program may then be executed on any computer, even if it does not have <span class="application">yabasic</span> installed.</p>
	  <p>Please see the section about <a class="link" href="#ref_standalone" title="Creating a standalone program from your yabasic-program">creating a <span class="emphasis"><em>standalone</em></span>-program</a> for details.</p>
	</div>
	<div class="refsection" id="id3974"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
if (!peek("isbound")) then
  bind "foo"
  print "Successfully created the standalone executable 'foo' !"
  exit
endif

print "Hello World !"
          </pre>
	    <p>This example creates a standalone program <code class="filename">foo</code> from itself.</p>
	  </div>
	</div>
	<div class="refsection" id="id3982"><h2>See also</h2>
	  
	  <p>The section about <a class="link" href="#ref_standalone" title="Creating a standalone program from your yabasic-program">creating a <span class="emphasis"><em>standalone</em></span>-program</a>, the <a class="link" href="#ref_peek" title="peek"><code class="function">peek</code></a>-function and the command line <a class="link" href="#chapter_options" title="Chapter&#160;4.&#160;Command line options of yabasic">options</a>.</p>
	</div>
      </div>

      <div class="refentry" id="ref_bitnot"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  bitnot()
	   &#8212; the bitwise arithmetic <code class="function">not</code>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
x=bitnot(a)
</pre>
	</div>
	<div class="refsection" id="id4001"><h2>Description</h2>
	  
	  <p>This function is used to compute the <span class="emphasis"><em>bitwise not</em></span> of its single argument. The argument is treated as binary number (i.e. a sequence of digits 0 and 1); a bit of the resulting value will be 1, if the argument has a 0 at this position in its binary representation; if the bit in the argument is 1, the bit in the result will be 0.</p>
	  <p>Note, that its argument is silently converted to a positive integer value and that negative numbers have their own binary representation and may lead to unexpected results when passed to <code class="function">bitnot</code>.</p>
	  <p>A note on naming: This one-argument-function is named <code class="function">bitnot</code> to distinguish it from the one-argument-function <a class="link" href="#ref_logical_not" title="not"><code class="function">not</code></a>, which operates on <span class="emphasis"><em>logical</em></span> expressions. For the similar functions <code class="function">and</code> and <code class="function">or</code> this distinction between <span class="emphasis"><em>logical</em></span> and <span class="emphasis"><em>bitwise</em></span> function is done implicitly through the number of arguments (1 and 2, respectively).</p>
	</div>
	<div class="refsection" id="id4018"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print bin$(not(17))
          </pre>
	    <p>This will print <code class="computeroutput">11111111111111111111111111101110</code>. This result is clear, if you note, that the binary representation of 17 is 10001, which inverted will give the long binary number given before.</p>
	  </div>
	</div>
	<div class="refsection" id="id4026"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_bitwise_or" title="or()"><code class="function">or</code></a>, <a class="link" href="#ref_eor" title="eor()"><code class="function">eor</code></a> and <a class="link" href="#ref_bitwise_and" title="and()"><code class="function">and</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_box"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  box
	   &#8212; draw a rectangle. A synonym for <code class="function">rectangle</code>
	</p></div>
	
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
See the <code class="function"><a class="link" href="#ref_rectangle" title="rectangle">rectangle</a></code>-command.
</pre>
	</div>
	<div class="refsection" id="id4048"><h2>Description</h2>
	  
	  <p>The <code class="function">box</code>-command does exactly the same as the <code class="function"><a class="link" href="#ref_rectangle" title="rectangle">rectangle</a></code>-command; it is just a <span class="emphasis"><em>synonym</em></span>. Therefore you should refer to the entry for the <code class="function"><a class="link" href="#ref_rectangle" title="rectangle">rectangle</a></code>-command for further information.</p>
	</div>
      </div>

      <div class="refentry" id="ref_break"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  break
	   &#8212; breaks out of one or more loops or switch statements
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">break</pre>
	  <pre class="synopsis">break 2</pre>
	</div>
	<div class="refsection" id="id4068"><h2>Description</h2>
	  
	  <p><code class="function">break</code> transfers control immediately outside the enclosing loop or switch statement. This is the preferred way of leaving a such a statement (rather than <code class="function">goto</code>, which is still possible in most cases). An optional digit allows one to break out of multiple levels, e.g. to leave a loop from within a switch statement. Please note, that only a literal (e.g. 2) is allowed at this location.</p>
	</div>
	<div class="refsection" id="id4075"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=1 to 10
  break
  print "Hi"
next a

while 1
  break
  print "Hi"
wend

repeat
  break
  print "Hi"
until 0

switch 1
case 1:break
case 2:case 3:print "Hi"
end switch
          </pre>
	    <p>This example prints nothing at all, because each of the loops (and the <code class="function">switch</code>-statement) does an immediate <code class="function">break</code> (before it could print any "Hi").</p>
	  </div>
	</div>
	<div class="refsection" id="id4084"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_for" title="for">for</a></code>, <code class="function"><a class="link" href="#ref_while" title="while">while</a></code>, <code class="function"><a class="link" href="#ref_repeat" title="repeat">repeat</a></code> and <code class="function"><a class="link" href="#ref_switch" title="switch">switch</a></code>.</p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_c"><div class="titlepage"><div><div><h2 class="title" style="clear: both">C</h2></div></div></div>
      

      <div class="refentry" id="ref_case"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  case
	   &#8212; mark the different cases within a <code class="function"><a class="link" href="#ref_switch" title="switch">switch</a></code>-statement
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
switch a
  case 1
  case 2
  &#8230;
end switch

&#8230;

switch a$
  case "a"
  case "b"
  &#8230;
end switch
</pre>
	</div>
	<div class="refsection" id="id4111"><h2>Description</h2>
	  
	  <p>Please see the <code class="function"><a class="link" href="#ref_switch" title="switch">switch</a></code>-statement.</p>
	</div>
	<div class="refsection" id="id4118"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input a
switch(a)
  case 1:print "one":break
  case 2:print "two":break
  default:print "more"
end switch
          </pre>
	    <p>Depending on your input (a number is expected) this code will print <code class="computeroutput">one</code> or <code class="computeroutput">two</code> or otherwise <code class="computeroutput">more</code>.</p>
	  </div>
	</div>
	<div class="refsection" id="id4128"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_switch" title="switch">switch</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_ceil"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  ceil()
	   &#8212; compute the ceiling for its (float) argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print ceil(x)
</pre>
	</div>
	<div class="refsection" id="id4143"><h2>Description</h2>
	  
	  <p>The <code class="function">ceil</code>-function returns the smallest integer number, that is larger or equal than its argument.</p>
	</div>
	<div class="refsection" id="id4149"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print ceil(1.5),floor(1.5)
print ceil(2),floor(2)
          </pre>
	    <p>Comparing functions <code class="function">ceil</code> and <code class="function">floor</code>, gives a first line of output (<code class="computeroutput">1 2</code>), showing that <code class="function">ceil</code> is less or equal than <code class="function">floor</code>; but as the second line of output (<code class="computeroutput">2 2</code>) shows, the two functions give equal results for integer arguments.</p>
	  </div>
	</div>
	<div class="refsection" id="id4162"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_floor" title="floor()">floor</a></code>, <code class="function"><a class="link" href="#ref_int" title="int()">int</a></code>, <code class="function"><a class="link" href="#ref_frac" title="frac()">frac</a></code>, <code class="function"><a class="link" href="#ref_round" title="round()">round</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_chomp"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  chomp$()
	   &#8212; remove a single trailing newline from its string-argument; if the string does not end in a newline, the string is returned unchanged
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">print chomp$("Hallo !\n")</pre>
	</div>
	<div class="refsection" id="id4183"><h2>Description</h2>
	  
	  <p>The <code class="function">chomp$</code>-function checks, if its string-argument ends in a newline and removes it eventually; for this purpose <code class="function">chomp$</code> can replace an <code class="function">if</code>-statement. This can be especially useful, when you deal with input from external sources like <code class="function"><a class="link" href="#ref_system2" title="system$()">system$</a></code>.</p>
	  <p>You may apply <code class="function">chomp$</code> freely, as it only acts, if there is a newline to remove; note however, that user-input, that comes from the normal <code class="function"><a class="link" href="#ref_input" title="input">input</a></code>-statement, does not need such a treatment, because it already comes without a newline.</p>
	</div>
	<div class="refsection" id="id4197"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <p>The following <span class="application">yabasic</span>-program uses the unix-command <span class="command"><strong>whoami</strong></span> to get the username of the current user in order to greet him personally. This is done twice: First with the <code class="function">chomp$</code>-function and then again with with an equivalent <code class="function">if</code>-statement:</p>
	    <pre class="programlisting">
print "Hello " + chomp$(system$("whoami")) + " !"

user$ = system$("whoami")
if (right$(user$,1)="\n") user$=left$(user$,len(user$)-1)
print "Hello again " + user$ + " !"
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id4208"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_system2" title="system$()">system$</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_chr"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  chr$()
	   &#8212; accepts a number and returns the character at this position within the <abbr class="acronym">ascii</abbr> charset
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">character$=chr$(ascii)</pre>
	</div>
	<div class="refsection" id="id4224"><h2>Description</h2>
	  
	  <p>The <code class="function">chr$</code>-function is the opposite of the <code class="function"><a class="link" href="#ref_asc" title="asc()">asc</a></code>-function. It looks up and returns the character at the given position within the <abbr class="acronym">ascii</abbr>-charset. It's typical use is to construct <span class="emphasis"><em>nonprintable</em></span> characters which do not occur on your keyboard.</p>
	  <p>Nevertheless you won't use <code class="function">chr$</code> as often as you might think, because the most important nonprintable characters can be constructed using <span class="emphasis"><em><a class="link" href="#ref_escape_sequences" title="Escape-sequences">escape-sequences</a></em></span> using the \-character (e.g. you might use \n instead of <code class="function">chr$(10)</code> wherever you want to use the newline-character).</p>
	</div>
	<div class="refsection" id="id4239"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "a",chr$(10),"b"
          </pre>
	    <p>This will print the letters 'a' and 'b' in different lines because of the intervening newline-character, which is returned by <code class="function">chr$(10)</code>.</p>
	  </div>
	</div>
	<div class="refsection" id="id4247"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_asc" title="asc()">asc</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_circle"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  circle
	   &#8212; draws a circle in the graphic-window
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
circle x,y,r
clear circle x,y,r
fill circle x,y,r
clear fill circle x,y,r
</pre>
	</div>
	<div class="refsection" id="id4262"><h2>Description</h2>
	  
	  <p>The <code class="function">circle</code>-command accepts three parameters: The x- and y-coordinates of the center and the radius of the circle.</p>
	  <p>Some more observations related with the <code class="function">circle</code>-command:</p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>The graphic-window must have been opened already.</p>
	    </li><li class="listitem">
	      <p>The circle may well extend over the boundaries of the window.</p>
	    </li><li class="listitem">
	      <p>If you have issued <code class="function"><a class="link" href="#ref_open_printer" title="open printer">open printer</a></code> before, the circle
will finally appear in the printed hard copy of the window.</p>
	    </li><li class="listitem">
	      <p><code class="function">fill circle</code> will draw a filled (with black ink) circle.</p>
	    </li><li class="listitem">
	      <p><code class="function">clear circle</code> will erase (or clear) the outline of the circle.</p>
	    </li><li class="listitem">
	      <p><code class="function">clear fill circle</code> or <code class="function">fill clear circle</code> will erase the full area of the circle.</p>
	    </li></ul></div>
	</div>
	<div class="refsection" id="id4289"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200

for n=1 to 2000
  x=ran(200)
  y=ran(200)
  fill circle x,y,10
  clear fill circle x,y,8
next n
          </pre>
	    <p>This code will open a window and draw 2000 overlapping circles within. Each circle is drawn in two steps: First it is filled with black ink (<code class="function">fill circle x,y,10</code>), then most of this circle is erased again (<code class="function">clear fill circle x,y,8</code>). As a result each circle is drawn with an opaque white interior and a 2-pixel outline (2-pixel, because the radii differ by two).</p>
	  </div>
	</div>
	<div class="refsection" id="id4298"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_open_window" title="open window">open window</a></code>, <code class="function"><a class="link" href="#ref_open_printer" title="open printer">open printer</a></code>, <code class="function"><a class="link" href="#ref_line" title="line">line</a></code>, <code class="function"><a class="link" href="#ref_rectangle" title="rectangle">rectangle</a></code>, <code class="function"><a class="link" href="#ref_triangle" title="triangle">triangle</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_clear"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  clear
	   &#8212; erase <code class="function">circle</code>s, <code class="function">rectangle</code>s or <code class="function">triangle</code>s
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
clear rectangle 10,10,90,90
clear fill circle 50,50,20
clear triangle 10,10,20,20,50,30
</pre>
	</div>
	<div class="refsection" id="id4324"><h2>Description</h2>
	  
	  <p>May be used within the <code class="function"><a class="link" href="#ref_circle" title="circle">circle</a></code>, <code class="function"><a class="link" href="#ref_rectangle" title="rectangle">rectangle</a></code> or <code class="function"><a class="link" href="#ref_triangle" title="triangle">triangle</a></code> command and causes these shapes to be erased (i.e. be drawn in the colour of the background).</p>
	  <p><code class="function">fill</code> can be used in conjunction with and wherever the <code class="function"><a class="link" href="#ref_fill" title="fill">fill</a></code>-clause may appear. Used alone, <code class="function">clear</code> will erase the outline (not the interior) of the shape (circle, rectangle or triangle); together with <code class="function">fill</code> the whole shape (including its interior) is erased.</p>
	</div>
	<div class="refsection" id="id4341"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
fill circle 100,100,50
clear fill rectangle 10,10,90,90
          </pre>
	    <p>This opens a window and draws a pacman-like figure.</p>
	  </div>
	</div>
	<div class="refsection" id="id4348"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_clear" title="clear">clear</a></code>, <code class="function"><a class="link" href="#ref_circle" title="circle">circle</a></code>, <code class="function"><a class="link" href="#ref_rectangle" title="rectangle">rectangle</a></code>, <code class="function"><a class="link" href="#ref_triangle" title="triangle">triangle</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_clear_screen"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  clear screen
	   &#8212; erases the text window
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
clear screen
</pre>
	</div>
	<div class="refsection" id="id4369"><h2>Description</h2>
	  
	  <p><code class="function">clear screen</code> erases the text window (the window where the output of <code class="function">print</code> appears).</p>
	  <p>It must be issued at least once, before some advanced screen-commands (e.g. <code class="function">print at</code> or <code class="function">inkey$</code>) may be called; this requirement is due to some limitations of the <code class="systemitem">curses</code>-library, which is used by <span class="application">yabasic</span> under <abbr class="acronym">Unix</abbr> for some commands.</p>
	</div>
	<div class="refsection" id="id4382"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
clear screen
print "Please press a key : ";
a$=inkey$
print a$
          </pre>
	    <p>The <code class="function">clear screen</code> command is essential here; if it would be omitted, <span class="application">yabasic</span> would issue an error ("<code class="computeroutput">need to call 'clear screen' first</code>") while trying to execute the <code class="function">inkey$</code>-function.</p>
	  </div>
	</div>
	<div class="refsection" id="id4393"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_inkey" title="inkey$">inkey$</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_clear_window"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  clear window
	   &#8212; clear the graphic window and begin a new page, if printing is under way
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">clear window</pre>
	</div>
	<div class="refsection" id="id4408"><h2>Description</h2>
	  
	  <p><code class="function">clear window</code> clears the graphic window. If you have started printing the graphic via <code class="function"><a class="link" href="#ref_open_printer" title="open printer">open printer</a></code>, the <code class="function">clear window</code>-command starts a new page as well.</p>
	</div>
	<div class="refsection" id="id4417"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
open printer "t.ps"

for a=1 to 10
if (a&gt;1) clear window
text 100,100,"Hallo "+str$(a)
next a

close printer
close window
          </pre>
	    <p>This example prints 10 pages, with the text "Hello 1", "Hello 2", &#8230; and so on. The <code class="function">clear screen</code>-command clears the graphics window and starts a new page.</p>
	  </div>
	</div>
	<div class="refsection" id="id4425"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_open_window" title="open window">open window</a></code>, <code class="function"><a class="link" href="#ref_open_printer" title="open printer">open printer</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_close"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  close
	   &#8212; close a file, which has been opened before
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
close filenum
close # filenum
</pre>
	</div>
	<div class="refsection" id="id4442"><h2>Description</h2>
	  
	  <p>The <code class="function">close</code>-command closes an open file. You should issue this command as soon as you are done with reading from or writing to a file.</p>
	  <p/>
	</div>
	<div class="refsection" id="id4449"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open "my.data" for reading as 1
input #1 a
print a
close 1
          </pre>
	    <p>This program opens the file <code class="systemitem">"my.data"</code>, reads a number from it, prints this number and closes the file again.</p>
	  </div>
	</div>
	<div class="refsection" id="id4457"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_open" title="open">open</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_close_curve"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  close curve
	   &#8212; close a curve, that has been drawn by the <code class="function">line</code>-command
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
new curve
line to x1,y1
&#8230;
close curve
</pre>
	</div>
	<div class="refsection" id="id4473"><h2>Description</h2>
	  
	  <p>The <code class="function">close curve</code>-command closes a sequence of lines, that has been drawn by repeated <code class="function">line to</code>-commands.</p>
	</div>
	<div class="refsection" id="id4480"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
new curve
line to 100,50
line to 150,150
line to 50,150
close curve
          </pre>
	    <p>This example draws a triangle: The three <code class="function">line to</code>-commands draw two lines; the final line is however not drawn explicitly, but drawn by the <code class="function">close curve</code>-command.</p>
	  </div>
	</div>
	<div class="refsection" id="id4489"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_line" title="line">line</a></code>, <code class="function"><a class="link" href="#ref_new_curve" title="new curve">new curve</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_close_printer"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  close printer
	   &#8212; stops printing of graphics
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">close printer</pre>
	</div>
	<div class="refsection" id="id4506"><h2>Description</h2>
	  
	  <p>The <code class="function">close printer</code>-command ends the printing graphics. Between <code class="function"><a class="link" href="#ref_open_printer" title="open printer">open printer</a></code> and <code class="function">close printer</code> everything you draw (e.g. circles, lines &#8230;) is sent to your printer. <code class="function">close printer</code> puts an end to printing and will make your printer eject the page.</p>
	</div>
	<div class="refsection" id="id4516"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
open printer
circle 100,100,50
close printer
close window
          </pre>
	    <p>As soon as <code class="function">close printer</code> is executed, your printer will eject a page with a circle on it.</p>
	  </div>
	</div>
	<div class="refsection" id="id4524"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_open_printer" title="open printer">open printer</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_close_window"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  close window
	   &#8212; close the graphics-window
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">close window</pre>
	</div>
	<div class="refsection" id="id4539"><h2>Description</h2>
	  
	  <p>The <code class="function">close window</code>-command closes the graphics-window, i.e. it makes it disappear from your screen. It includes an implicit <code class="function">close printer</code>, if a printer has been opened previously.</p>
	</div>
	<div class="refsection" id="id4546"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
circle 100,100,50
close window
          </pre>
	    <p>This example will open a window, draw a circle and close the window again; all this without any pause or delay, so the window will be closed before you may regard the circle..</p>
	  </div>
	</div>
	<div class="refsection" id="id4553"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_open_printer" title="open printer">open window</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_color"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  color
	   &#8212; change color for any subsequent drawing-command
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
colour red,green,blue
colour "red,green,blue"
</pre>
	</div>
	<div class="refsection" id="id4568"><h2>Description</h2>
	  
	  <p>Change the color, in which lines, dots, circles, rectangles or triangles are drawn. The <code class="function">color</code>-command accepts three numbers in the range 0 &#8230; 255 (as in the first line of the synopsis above). Those numbers specify the intensity for the primary colors red, green and blue respectively. As an example <code class="function">255,0,0</code> is red and <code class="function">255,255,0</code> is yellow.</p>
	  <p>Alternatively you may specify the color with a single string (as in the second line of the synopsis above); this string should contain three numbers, separated by commas. As an example <code class="function">"255,0,255"</code> would be violet. Using this variant of the <code class="function">colour</code>-command, you may use symbolic names for colours:</p>
	  <pre class="programlisting">
open window 100,100
yellow$="255,255,0"
color yellow$
text 50,50,"Hallo"
	  </pre>
	  <p>, which reads much clearer.</p>
	</div>
	<div class="refsection" id="id4581"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 255,255
for x=10 to 235 step 10:for y=10 to 235 step 10
  	colour x,y,0
  	fill rectangle x,y,x+10,y+10
next y:next x
            </pre>
	    <p>This fills the window with colored rectangles. However, none of the used colours contains any shade of blue, because the <code class="function">color</code>-command has always 0 as a third argument.</p>
	  </div>
	  <p>Note, that the command <code class="function">color</code> can be written as <code class="function">colour</code> too and vice versa.</p>
	</div>
	<div class="refsection" id="id4592"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_open_window" title="open window">open window</a></code>, <code class="function"><a class="link" href="#ref_backcolor" title="backcolor">backcolor</a></code>, <code class="function"><a class="link" href="#ref_line" title="line">line</a></code>, <code class="function"><a class="link" href="#ref_rectangle" title="rectangle">rectangle</a></code>, <code class="function"><a class="link" href="#ref_triangle" title="triangle">triangle</a></code>, <code class="function"><a class="link" href="#ref_circle" title="circle">circle</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_compile"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  compile
	   &#8212; compile a string with <abbr class="acronym">yabasic</abbr>-code <span class="emphasis"><em>on the fly</em></span>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">compile(code$)</pre>
	</div>
	<div class="refsection" id="id4619"><h2>Description</h2>
	  
	  <p>This is an advanced command (closely related with the <code class="function"><a class="link" href="#ref_execute" title="execute()">execute</a></code>-command). It allows you to compile a string of yabasic-code (which is the only argument). Afterwards the compiled code is a normal part of your program.</p>
	  <p>Note, that there is no way to <span class="emphasis"><em>remove</em></span> the compiled code.</p>
	</div>
	<div class="refsection" id="id4628"><h2>Examples</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
compile("sub mysub(a):print a:end sub")
mysub(2)
          </pre>
	    <p>This example creates a function named <code class="function">mysub</code>, which simply prints its single argument.</p>
	  </div>
	</div>
	<div class="refsection" id="id4636"><h2>Another Example</h2>
	  
	  <p>This next example combines the functions <code class="function">compile</code> and <code class="function"><a class="link" href="#ref_execute" title="execute()">execute</a></code>:</p>
	  <div class="informalexample">
	    <pre class="programlisting">
count = 1	      
subname$ = "foo" + str$(count)
compile("sub "+ subname$ + "(a):print a:end sub")
execute(subname$,2)
          </pre>
	    <p>This example creates and executes a function, whose name (<code class="function">foo1</code>) is stored within the variable <code class="varname">subname$</code>; the newly created function simply prints its single argument. This example could be executed multiple times within a single <span class="application">yabasic</span>-program, simply by incrementing the variable <code class="varname">count</code>; by doing that, multiple subroutines (<code class="function">foo1</code>, <code class="function">foo2</code>, &#8230;) could be created and executed in succession.</p>
	  </div>
	</div>
	<div class="refsection" id="id4653"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_add_code" title="Adding code to a running program">adding code during execution</a>, <code class="function"><a class="link" href="#ref_execute" title="execute()">execute</a></code>, <code class="function"><a class="link" href="#ref_execute2" title="execute$()">execute$</a></code>, <code class="function"><a class="link" href="#ref_eval" title="eval()">eval</a></code>, <code class="function"><a class="link" href="#ref_eval2" title="eval$()">eval$</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_continue"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  continue
	   &#8212; start the next iteration of a <code class="function">for</code>-, <code class="function">do</code>-, <code class="function">repeat</code>- or <code class="function">while</code>-loop
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">continue</pre>
	</div>
	<div class="refsection" id="id4679"><h2>Description</h2>
	  
	  <p>You may use <code class="function">continue</code> within any loop to start the next iteration immediately. Depending on the type of the loop, the loop-condition will or will not be checked. Especially: <code class="function">for</code>- and <code class="function">while</code>-loops will evaluate their respective conditions, <code class="function">do</code>- and <code class="function">repeat</code>-loops will not.</p>
	  <p class="remark"><em><span class="remark">Remark: Another way to change the flow of execution within a loop, is the break-command.</span></em></p>
	</div>
	<div class="refsection" id="id4690"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=1 to 100
  if mod(a,2)=0 continue
  print a
next a
          </pre>
	    <p>This example will print all odd numbers between 1 and 100.</p>
	  </div>
	</div>
	<div class="refsection" id="id4697"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_for" title="for">for</a></code>, <code class="function"><a class="link" href="#ref_do" title="do">do</a></code>, <code class="function"><a class="link" href="#ref_repeat" title="repeat">repeat</a></code>, <code class="function"><a class="link" href="#ref_while" title="while">while</a></code>, <code class="function"><a class="link" href="#ref_break" title="break">break</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_cos"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  cos()
	   &#8212; return the cosine of its single argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
x=cos(angle)
</pre>
	</div>
	<div class="refsection" id="id4720"><h2>Description</h2>
	  
	  <p>The <code class="function">cos</code>-function expects an angle (in radians) and returns its cosine.</p>
	</div>
	<div class="refsection" id="id4726"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print cos(pi)
          </pre>
	    <p>This example will print <code class="computeroutput">-1</code>.</p>
	  </div>
	</div>
	<div class="refsection" id="id4734"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_acos" title="acos()">acos</a></code>, <code class="function"><a class="link" href="#ref_sin" title="sin()">sin</a></code></p>
	</div>
      </div>
    </section>

    <section class="section" id="ref_d"><div class="titlepage"><div><div><h2 class="title" style="clear: both">D</h2></div></div></div>
      

      <div class="refentry" id="ref_data"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  data
	   &#8212; introduces a list of data-items
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
data 9,"world"
&#8230;
read b,a$
</pre>
	</div>
	<div class="refsection" id="id4755"><h2>Description</h2>
	  
	  <p>The <code class="function">data</code>-keyword introduces a list of comma-separated list of strings or numbers, which may be retrieved with the <code class="function"><a class="link" href="#ref_read" title="read">read</a></code>-command.</p>
	  <p>The <code class="function">data</code>-command itself does nothing; it just stores data. A single <code class="function">data</code>-command may precede an arbitrarily long list of values, in which strings or numbers may be mixed at will.</p>
	  <p><span class="application">yabasic</span> internally uses a <code class="systemitem">data-pointer</code> to keep track of the current location within the <code class="function">data</code>-list; this pointer may be reset with the <code class="function"><a class="link" href="#ref_restore" title="restore">restore</a></code>-command.</p>
	</div>
	<div class="refsection" id="id4772"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
do
  restore
  for a=1 to 4
    read num$,num
    print num$,"=",num
  next a
loop
data "eleven",11,"twelve",12,"thirteen",13,"fourteen",14
          </pre>
	    <p>This example just prints a series of lines <code class="computeroutput">eleven=11</code> up to <code class="computeroutput">fourteen=14</code> and so on without end.</p>
	    <p>The <code class="function">restore</code>-command ensures that the list of <code class="function">data</code>-items is read from the start with every iteration.</p>
	  </div>
	</div>
	<div class="refsection" id="id4784"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_read" title="read">read</a></code>, <code class="function"><a class="link" href="#ref_restore" title="restore">restore</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_date"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  date$
	   &#8212; returns a string with various components of the current date
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">a$=date$</pre>
	</div>
	<div class="refsection" id="id4801"><h2>Description</h2>
	  
	  <p>The <code class="function">date$</code>-function (which <span class="emphasis"><em>must</em></span> be called without parentheses; i.e. <code class="function">date$()</code> would be an error) returns a string containing various components of a date; an example would be <code class="computeroutput">4-05-27-2004-Thu-May</code>. This string consists of various fields separated by hyphens ("<code class="computeroutput">-</code>"):</p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>The day within the week as a number in the range 0 (=Sunday) to 6 (=Saturday) (in the example above: <code class="computeroutput">4</code>, i.e. Thursday).</p>
	    </li><li class="listitem">
	      <p>The month as a number in the range 1 (=January) to 12 (=December) (in the example: <code class="computeroutput">5</code> which stands for May).</p>
	    </li><li class="listitem">
	      <p>The day within the month as a number in the range 1 to 31 (in the example: <code class="computeroutput">27</code>).</p>
	    </li><li class="listitem">
	      <p>The full, 4-digit  year (in the example: <code class="computeroutput">2004</code>, which reminds me that I should adjust the clock within my computer &#8230;).</p>
	    </li><li class="listitem">
	      <p>The abbreviated name of the day within the week (<code class="computeroutput">Mon</code> to <code class="computeroutput">Sun</code>).</p>
	    </li><li class="listitem">
	      <p>The abbreviated name of the month (<code class="computeroutput">Jan</code> to <code class="computeroutput">Dec</code>).</p>
	    </li></ul></div>
	  <p>Therefore the whole example above (<code class="computeroutput">4-05-27-2004-Thu-May</code>) would read: day 4 in the week (counting from 0), May 27 in the year 2004, which is a Thursday in May.</p>
	  <p>Note, that all fields within the string returned by <code class="function">date$</code> have a fixed with (numbers are padded with zeroes); therefore it is easy to extract the various fields of a date format with <code class="function">mid$</code>.</p>
	</div>
	<div class="refsection" id="id4837"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
rem   Two ways to print the same ...

print mid$(date$,3,10)

dim fields$(6)
a=split(date$,fields$(),"-")
print fields$(2),"-",fields$(3),"-",fields$(4)
          </pre>
	    <p>This example shows two different techniques to extract components from the value returned by <code class="function">date$</code>. The <code class="function">mid$</code>-function is the preferred way, but you could just as well <code class="function">split</code> the return-value of <code class="function">date$</code> at every "-" and store the result within an array of strings.</p>
	  </div>
	</div>
	<div class="refsection" id="id4848"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_time" title="time$">time$</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_dec"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  dec()
	   &#8212; convert a base 2 or base 16 number into decimal form
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
a=dec(number$)
a=dec(number$,base)
</pre>
	</div>
	<div class="refsection" id="id4863"><h2>Description</h2>
	  
	  <p>The <code class="function">dec</code>-function takes the string-representation of a base-2 or base-16 (which is the default) number and converts it into a decimal number. The optional second argument (<code class="varname">base</code>) might be used to specify a base other than 16. However, currently only base 2 or base 16 are supported. Please note, that for base 16 and 2 you may write literals in the usual way, by preceding them with <code class="literal">0x</code> or <code class="literal">0b</code> respectively, e.g. like </p><pre class="programlisting">print 0xff + 0b11</pre><p>; this may save you from applying the <code class="function">dec</code> altogether.</p>
	</div>
	<div class="refsection" id="id4874"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a binary number: " a$
print a$," is ",dec(a$)
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id4880"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_bin" title="bin$()"><code class="function">bin$</code></a>, <a class="link" href="#ref_hex" title="hex$()"><code class="function">hex$</code></a>, <a class="link" href="#top_numbers_with_base_2_or_16" title="Numbers with base 2 or 16">numbers with base 2 or 16</a></p>
	</div>
      </div>

      <div class="refentry" id="ref_default"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  default
	   &#8212; mark the <span class="emphasis"><em>default</em></span>-branch within a <code class="function"><a class="link" href="#ref_switch" title="switch">switch</a></code>-statement
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
switch a+3
case 1
  &#8230;
case 2
  &#8230;
default
  &#8230;
end switch
</pre>
	</div>
	<div class="refsection" id="id4901"><h2>Description</h2>
	  
	  <p>The <code class="function">default</code>-clause is an optional part of the <code class="function"><a class="link" href="#ref_switch" title="switch">switch</a></code>-statement (see there for more information). It introduces a series of statements, that should be executed, if none of the cases matches, that have been specified before (each with its own <code class="function"><a class="link" href="#ref_case" title="case">case</a></code>-clause).</p>
	  <p>So <code class="function">default</code> specifies a default to be executed, if none of the explicitly named cases matches; hence its name.</p>
	</div>
	<div class="refsection" id="id4913"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "Please enter a number between 0 and 6,"
print "specifying a day in the week."
input d
switch d
case 0:print "Monday":break
case 1:print "Tuesday":break
case 2:print "Wednesday":break
case 3:print "Thursday":break
case 4:print "Friday":break
case 5:print "Saturday":break
case 6:print "Sunday":break
default:print "Hey you entered something invalid !"
end switch
          </pre>
	    <p>This program translates a number between 0 and 6 into the name of a weekday; the <code class="function">default</code>-case is used to detect (and complain about) invalid input.</p>
	  </div>
	</div>
	<div class="refsection" id="id4921"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_sub" title="sub"><code class="function">sub</code></a>, <a class="link" href="#ref_case" title="case"><code class="function">case</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_dim"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  dim
	   &#8212; create an array prior to its first use
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
dim array(x,y)
dim array$(x,y)
</pre>
	</div>
	<div class="refsection" id="id4938"><h2>Description</h2>
	  
	  <p>The <code class="function">dim</code>-command prepares one or more arrays (of either strings or numbers) for later use. This command can also be used to enlarges an existing array.</p>
	  <p>When an array is created with the <code class="function">dim</code>-statement, memory is allocated and all elements are initialized with either 0 (for numerical arrays) or "" (for string arrays). Please be aware, that the <code class="function">dim</code> reserves room for one element <span class="emphasis"><em>more</em></span> than actually specified, e.g. <code class="code">dim(10)</code> reserves memory for <span class="emphasis"><em>11</em></span> elements. This makes it possible to access element 0 as well as element 10, which serves the conventions of <span class="application">C</span> as well as <abbr class="acronym">basic</abbr>.</p>
	  <p>If the array already existed, and the <code class="function">dim</code>-statement specifies a larger size than the current size, the array is enlarged and any old content is preserved. But note, that <code class="function">dim</code> cannot be used to shrink an array: If you specify a size, that is smaller than the current size, the <code class="function">dim</code>-command does nothing.</p>
	  <p>Finally: To create an array, that is only known within a single subroutine, you should use the command <code class="function"><a class="link" href="#ref_local" title="local">local</a></code>, which creates local variables as well as local arrays.</p>
	</div>
	<div class="refsection" id="id4959"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
dim a(5,5)

for x=1 to 5:for y=1 to 5
  a(x,y)=int(ran(100))
next y:next x

printmatrix(a())

dim a(7,7)

printmatrix(a())

sub printmatrix(ar())
  local x,y,p,q
  x=arraysize(ar(),1)
  y=arraysize(ar(),2)
  for q=1 to y
    for p=1 to y
      print ar(p,q),"\t";
    next p
    print
  next q
end sub
          </pre>
	    <p>This example creates a 2-dimensional array (i.e. a <span class="emphasis"><em>matrix</em></span>) with the <code class="function">dim</code>-statement and fills it with random numbers. The second <code class="function">dim</code>-statement enlarges the array, all new elements are filled with 0.</p>
	    <p>The subroutine <code class="function">printmatrix</code> just does, what its name says.</p>
	  </div>
	</div>
	<div class="refsection" id="id4971"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_arraysize" title="arraysize()"><code class="function">arraysize</code></a>, <a class="link" href="#ref_arraydim" title="arraydim()"><code class="function">arraydim</code></a>, <code class="function"><a class="link" href="#ref_local" title="local">local</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_do"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  do
	   &#8212; start a (conditionless) <code class="function">do-loop</code>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
do 
&#8230; 
loop</pre>
	</div>
	<div class="refsection" id="id4991"><h2>Description</h2>
	  
	  <p>Starts a loop, which is terminated by <code class="function">loop</code>; everything between <code class="function">do</code> and <code class="function">loop</code> will be repeated forever. This loop has no condition, so it is an infinite loop; note however, that a <code class="function"><a class="link" href="#ref_break" title="break">break</a></code>- or <code class="function"><a class="link" href="#ref_goto" title="goto">goto</a></code>-statement might be used to leave this loop anytime.</p>
	</div>
	<div class="refsection" id="id5003"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
do
  a=a+1
  print a
  if (a&gt;100) break
loop
          </pre>
	    <p>This example prints the numbers between 1 and 101. The <code class="function">break</code>-statement is used to leave the loop.</p>
	  </div>
	</div>
	<div class="refsection" id="id5011"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_loop" title="loop"><code class="function">loop</code></a>, <a class="link" href="#ref_repeat" title="repeat"><code class="function">repeat</code></a>, <a class="link" href="#ref_while" title="while"><code class="function">while</code></a>, <a class="link" href="#ref_break" title="break"><code class="function">break</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_doc"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  doc
	   &#8212; special comment, which might be retrieved by the program itself
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
doc   This is a comment
docu  This is another comment
</pre>
	</div>
	<div class="refsection" id="id5032"><h2>Description</h2>
	  
	  <p>Introduces a comment, which spans up to the end of the line. But other than the <a class="link" href="#ref_rem" title="rem"><code class="function">rem</code></a>-comment, any <code class="function">docu</code>-comment is collected within the special <code class="function"><a class="link" href="#ref_docu" title="docu$">docu$</a></code>-array and might be retrieved later on. Moreover you might invoke <span class="application">yabasic -docu foo.yab</span> on the <span class="emphasis"><em>command line</em></span> to retrieve the embedded documentation within the program <code class="literal">foo.yab</code>.</p>
	  <p>Instead of <code class="function">doc</code> you may just as well write <code class="function">docu</code> or even <code class="function">documentation</code>.</p>
	</div>
	<div class="refsection" id="id5049"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
rem   Hi, this has been written by me
rem
doc   This program asks for a number and
doc   prints this number multiplied with 2
rem
rem   Print out the above message
rem
for a=1 to arraysize(docu$(),1):print docu$(a):next a

rem   Read and print the number
input "Please input a number: " x
print x*2
          </pre>
	  <p>This program uses the comments within its code to print out a help message for the user; if you run this program, you get this output:</p>
	  <pre class="screen">
  This program asks for a number and
  prints this number multiplied with 2
Please input a number: 2
4
</pre>

	    <p>The contents of the <code class="function">doc</code>-lines are retrieved from the <code class="function">docu$</code>-array; if you do not want a comment to be collected within this array, use the <code class="function">rem</code>-statement instead.</p>
	  </div>
	</div>
	<div class="refsection" id="id5061"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_docu" title="docu$"><code class="function">docu$</code></a>, <a class="link" href="#ref_rem" title="rem"><code class="function">rem</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_docu"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  docu$
	   &#8212; special array, containing the contents of all docu-statement within the program
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">a$=docu$(1)</pre>
	</div>
	<div class="refsection" id="id5078"><h2>Description</h2>
	  
	  <p>Before your program is executed, <span class="application">yabasic</span> collects the content of all the <code class="function">doc</code>-statements within your program within this 1-dimensional array (well only those within the main-program, libraries are skipped).</p>
	  <p>You may use the <code class="function">arraysize</code> function to find out, how many lines it contains.</p>
	</div>
	<div class="refsection" id="id5087"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
docu
docu  This program reads two numbers 
docu  and adds them.
docu

rem retrieve and print the embedded documentation
for a=1 to arraysize(docu$(),1)
  print docu$(a)
next a

input "First number: " b
input "Second number: " c

print "The sum of ",b," and ",c," is ",b+c
          </pre>
	    <p>This program uses the embedded documentation to issue a usage-message.</p>
	  </div>
	</div>
	<div class="refsection" id="id5094"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_arraysize" title="arraysize()"><code class="function">arraydim</code></a>, <a class="link" href="#ref_rem" title="rem"><code class="function">rem</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_dot"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  dot
	   &#8212; draw a dot in the graphic-window
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
dot x,y
clear dot x,y
</pre>
	</div>
	<div class="refsection" id="id5111"><h2>Description</h2>
	  
	  <p>Draws a dot at the specified coordinates within your graphic-window. If <a class="link" href="#ref_open_printer" title="open printer">printing</a> is in effect, the dot appears on your printout too.</p>
	  <p>Use the functions <a class="link" href="#ref_peek" title="peek"><code class="function">peek("winheight")</code></a> or <a class="link" href="#ref_peek" title="peek"><code class="function">peek("winwidth")</code></a> to get the size of your window and hence the boundaries of the coordinates specified for the <code class="function">dot</code>-command.</p>
	</div>
	<div class="refsection" id="id5123"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
circle 100,100,100
do
  x=ran(200):y=ran(200)
  dot x,y
  total=total+1
  if (sqrt((x-100)^2+(y-100)^2)&lt;100) in=in+1
  print 4*in/total
loop
          </pre>
	    <p>This program uses a well known algorithm to compute &#960;.</p>
	  </div>
	</div>
	<div class="refsection" id="id5130"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_line" title="line"><code class="function">line</code></a>, <a class="link" href="#ref_open_window" title="open window"><code class="function">open window</code></a></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_e"><div class="titlepage"><div><div><h2 class="title" style="clear: both">E</h2></div></div></div>
      

      <div class="refentry" id="ref_else"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  else
	   &#8212; mark an alternative within an <code class="function">if</code>-statement
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
if (&#8230;) then 
  &#8230; 
else 
  &#8230; 
endif
</pre>
	</div>
	<div class="refsection" id="id5152"><h2>Description</h2>
	  
	  <p>The <code class="function">else</code>-statement introduces the alternate branch of an <code class="function">if</code>-statement. I.e. it starts the sequence of statements, which is executed, if the condition of the <code class="function">if</code>-statement is <span class="emphasis"><em>not</em></span> true.</p>
	</div>
	<div class="refsection" id="id5161"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a number: " a
if (mod(a,2)=1) then
  print a," is odd."
else
  print a," is even."
endif
          </pre>
	    <p>This program detects, if the number you have entered is even or odd.</p>
	  </div>
	</div>
	<div class="refsection" id="id5168"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_if" title="if"><code class="function">if</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_elsif"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  elsif
	   &#8212; starts an alternate condition within an <code class="function">if</code>-statement
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
if (&#8230;) then
  &#8230;
elseif (&#8230;) 
  &#8230;
elsif (&#8230;) then
  &#8230;
else
  &#8230;
endif
</pre>
	</div>
	<div class="refsection" id="id5184"><h2>Description</h2>
	  
	  <p>The <code class="function">elsif</code>-statement is used to select a single alternative among a series of choices.</p>
	  <p>With each <code class="function">elsif</code>-statement you may specify a condition, which is tested, if the main condition (specified with the <code class="function">if</code>-statement) has failed. Note that <code class="function">elsif</code> might be just as well written as <code class="function">elseif</code>.</p>
	  <p>Within the example below, two variables <code class="function">a</code> and <code class="function">b</code> are tested against a range of values. The variable <code class="varname">a</code> is tested with the <code class="function">elsif</code>-statement. The very same tests are performed for the variable <code class="varname">b</code> too; but here an involved series of <code class="function">if</code>-<code class="function">else</code>-statements is employed, making the tests much more obscure.</p>
	</div>
	<div class="refsection" id="id5203"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a number: " a
if (a&lt;0) then
  print "less than 0"
elseif (a&lt;=10) then
  print "between 0 and 10"
elsif (a&lt;=20)
  print "between 11 and 20"
else
  print "over 20"
endif

input "Please enter another number: " b
if (b&lt;0) then
  print "less than 0"
else
  if (b&lt;=10) then
    print "between 0 and 10"
  else
    if (b&lt;=20) then
      print "between 11 and 20"
    else
      print "over 20"
    endif
  endif
endif
          </pre>
	    <p>Note, that the very same tests are performed for the variables <code class="function">a</code> and <code class="function">b</code>, but can be stated much more clearly with the <code class="function">elsif</code>-statement.</p>
	    <p>Note, that <code class="function">elsif</code> might be written as <code class="function">elseif</code> too, and that the keyword <code class="function">then</code> is optional.</p>
	  </div>
	</div>
	<div class="refsection" id="id5217"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_if" title="if"><code class="function">if</code></a>, <a class="link" href="#ref_else" title="else"><code class="function">else</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_end"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  end
	   &#8212; terminate your program
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
end
</pre>
	</div>
	<div class="refsection" id="id5234"><h2>Description</h2>
	  
	  <p>Terminate your program. Much (but not exactly) like the <code class="function"><a class="link" href="#ref_exit" title="exit">exit</a></code> command.</p>
	  <p>Note, that <code class="function">end</code> may not end your program immediately; if you have opened a window or called <code class="function">clear screen</code>, <span class="application">yabasic</span> assumes, that your user wants to study the output of your program after it has ended; therefore it issues the line <code class="computeroutput">---Program done, press RETURN---</code> and waits for a key to be pressed. If you do not like this behaviour, consider using <code class="function"><a class="link" href="#ref_exit" title="exit">exit</a></code>.</p>
	</div>
	<div class="refsection" id="id5248"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "Do you want to continue ?"
input "Please answer y(es) or n(o): " a$
if (lower$(left$(a$,1))="n") then
  print "bye"
  end
fi
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id5254"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_exit" title="exit">exit</a></code></p>
	</div>
      </div>


      <div class="refentry" id="ref_endif"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  endif
	   &#8212; ends an <code class="function">if</code>-statement
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
if (&#8230;) then
  &#8230;
endif
</pre>
	</div>
	<div class="refsection" id="id5270"><h2>Description</h2>
	  
	  <p>The <code class="function">endif</code>-statement closes (or ends) an <code class="function">if</code>-statement.</p>
	  <p>Note, that <code class="function">endif</code> may be written in a variety of other ways: <code class="function">end if</code>, <code class="function">end-if</code> or even <code class="function">fi</code>.</p>
	  <p>The <code class="function">endif</code>-statement must be omitted, if the <code class="function">if</code>-statement does not contain the keyword <code class="function">then</code> (see the example below). Such an <a class="link" href="#ref_if" title="if"><code class="function">if</code></a>-statement without <code class="function">endif</code> extends only over a single line.</p>
	</div>
	<div class="refsection" id="id5289"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "A number please: " a
if (a&lt;10) then
  print "Your number is less than 10."
endif

REM  and now without endif 

input "A number please: " a
if (a&lt;10) print "Your number is less than 10."
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id5295"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_if" title="if"><code class="function">if</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_end_sub"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  end sub
	   &#8212; ends a subroutine definition
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
sub foo(&#8230;) 
  &#8230;
end sub
</pre>
	</div>
	<div class="refsection" id="id5310"><h2>Description</h2>
	  
	  <p>Marks the end of a subroutine-definition (which starts with the <code class="function">sub</code>-keyword).
	  The whole concept of subroutines is explained within the entry for <a class="link" href="#ref_sub" title="sub"><code class="function">sub</code></a>.
</p>
	</div>
	<div class="refsection" id="id5318"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print foo(3)

sub foo(a)
  return a*2
end sub
          </pre>
	    <p>This program prints out <code class="computeroutput">6</code>. The subroutine <code class="function">foo</code> simply returns twice its argument.</p>
	  </div>
	</div>
	<div class="refsection" id="id5327"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_sub" title="sub"><code class="function">sub</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_eof"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  eof
	   &#8212; check, if an open file contains data
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
open 1,"foo.bar"
if (eof(1)) then 
   &#8230;
end if
</pre>
	</div>
	<div class="refsection" id="id5342"><h2>Description</h2>
	  
	  <p>The <code class="function">eof</code>-function checks, if there is still data left within an open file. As an argument it expects the file-number as returned by (or used within) the <code class="function">open</code>-function (or statement).</p>
	  <p>As a special case, if the argument is zero: test if input from stdin is available.</p>
	</div>
	<div class="refsection" id="id5350"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
a=open("foo.bar")
while not eof(a)
  input #a,a$
  print a$
end while
          </pre>
	    <p>This example will print the contents of the file "foo.bar". The <code class="function">eof</code>-function will terminate the loop, if there is no more data left within the file. </p>
	  </div>
	</div>
	<div class="refsection" id="id5358"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_open" title="open"><code class="function">open</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_eor"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  eor()
	   &#8212; compute the bitwise <span class="emphasis"><em>exclusive or</em></span> of its two arguments
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">print eor(a,b)</pre>
	</div>
	<div class="refsection" id="id5374"><h2>Description</h2>
	  
	  <p>The <code class="function">eor</code>-function takes two arguments and computes their bitwise <span class="emphasis"><em>exclusive or</em></span>. I.e. treat each arguments as a sequence of bits and compare theses two sequences bit by bit to produce the result. If the bits from the arguments are equal, the resulting bit will be <code class="literal">0</code>, otherwise <code class="literal">1</code>.</p>
	  <p>The <code class="function">xor</code>-function is the same as the <code class="function">eor</code> function; both are synonymous; however they have each their own description, so you may check out the entry of <code class="function"><a class="link" href="#ref_xor" title="xor()">xor</a></code> for a slightly different view.</p>
	</div>
	<div class="refsection" id="id5388"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=0 to 3
  for b=0 to 3
    print fill$(bin$(a))," eor ",fill$(bin$(b))," = ",fill$(bin$(eor(a,b)))
  next b
next a

sub fill$(a$)
  return right$("0"+a$,2)
end sub
          </pre>
	    <p>This example prints a table, from which you may figure, how the <code class="function">eor</code>-function is computed.</p>
	  </div>
	</div>
	<div class="refsection" id="id5396"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_bitwise_and" title="and()"><code class="function">and</code></a>, <a class="link" href="#ref_bitwise_or" title="or()"><code class="function">or</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_error"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  error
	   &#8212; raise an error and terminate your program
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">error "Wrong, wrong, wrong !!"</pre>
	</div>
	<div class="refsection" id="id5413"><h2>Description</h2>
	  
	  <p>Produces the same kind or error messages, that yabasic itself produces (e.g. in case of a syntax-error). The single argument is issued along with the current line-number.</p>
	</div>
	<div class="refsection" id="id5418"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a number between 1 and 10: " a
if (a&lt;1 or a&gt;10) error "Oh no ..."
          </pre>
	    <p>This program is very harsh in checking the users input; instead of just asking again, the program terminates with an error, if the user enters something wrong.</p>
	    <p>The error message would look like this:</p>
	    <pre class="programlisting">
---Error in t.yab, line 2: Oh no ...
---Error: Program stopped due to an error
</pre>
	  </div>
	</div>
	<div class="refsection" id="id5427"><h2>See also</h2>
	  
	  <p>Well, there <span class="emphasis"><em>should</em></span> be a corresponding called <code class="function">warning</code>; unfortunately ther is none yet.</p>
	</div>
      </div>

      <div class="refentry" id="ref_euler"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  euler
	   &#8212; another name for the constant <code class="function">2.71828182864</code>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">foo=euler</pre>
	</div>
	<div class="refsection" id="id5443"><h2>Description</h2>
	  
	  <p><code class="function">euler</code> is the well known constant named after <span class="emphasis"><em>Leonard Euler</em></span>; its value is <code class="function">2.71828182864</code>. <code class="function">euler</code> is <span class="emphasis"><em>not</em></span> a function, so parens are not allowed (i.e. <code class="function">euler()</code> will produce an error). Finally, you may not assign to <code class="function">euler</code>; it wouldn't sense anyway, because it is a constant.</p>
	</div>
	<div class="refsection" id="id5455"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print euler
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id5461"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_pi" title="pi">pi</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_eval"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  eval()
	   &#8212; compile and execute a single numeric expression
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">print eval("1+2")</pre>
	</div>
	<div class="refsection" id="id5476"><h2>Description</h2>
	  
	  <p><code class="function">eval</code> accepts a string, which should be the text of a single numeric expression; it processes the expression and returns the result. All numeric functions and arithmetic operators of <span class="application">yabasic</span> can be used as well as any variables known.</p>
	  <p>The string passed to <code class="function">eval</code> is first compiled and then executed <span class="emphasis"><em>right away</em></span>. The compilation happens just before the execution and may cause compilation errors, if you pass an invalid expression. <code class="function">eval</code> might come handy, if you want to calculate an expression, that is not known at the start of your program, e.g. because it is read from the user; see the example below.</p>
	</div>
	<div class="refsection" id="id5487"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter an aritmetic expression involving the variable x: " expr$
first = true
for x=0 to 100 step 0.01
  result = eval(expr$)
  if (first or result &gt; maximum) maximum = result: xmaximum = x
  first = false
next x
print "In the range 0 to 100, expression " + expr$ + " has its maximum of " + str$(maximum) + " at " + str$(xmaximum) + " (approximately)"
          </pre>
	    <p>The example above reads an arithmetic expression from the user and steps through the range 0 &#8230; 100 to find its maximum. If the user types e.g. <strong class="userinput"><code>-(x-50)**2</code></strong>, the program would find a maximum of around zero (e.g. <code class="computeroutput">-1.90013e-24</code>) at 50.</p>
	  </div>
	</div>
	<div class="refsection" id="id5496"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_add_code" title="Adding code to a running program">adding code during execution</a>, <code class="function"><a class="link" href="#ref_eval2" title="eval$()">eval$</a></code>, <code class="function"><a class="link" href="#ref_compile" title="compile">compile</a></code>, <code class="function"><a class="link" href="#ref_execute" title="execute()">execute</a></code>, <code class="function"><a class="link" href="#ref_execute2" title="execute$()">execute$</a></code></p>
	</div>
      </div>
      
      <div class="refentry" id="ref_eval2"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  eval$()
	   &#8212; compile and execute a single string-expression
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">print eval$("a$ + b$")</pre>
	</div>
	<div class="refsection" id="id5518"><h2>Description</h2>
	  
	  <p><code class="function">eval$</code> accepts a string, which should be the text of a single string-expression; it processes the expression and returns the result. All string-functions and string-operators of <span class="application">yabasic</span> can be used as well as any variables known.</p>
	  <p>The string passed to <code class="function">eval$</code> is first compiled and then executed <span class="emphasis"><em>right away</em></span>. The compilation happens right before the execution and may cause compilation errors, if you pass an invalid expression. See the example below for two interesting use-cases.</p>
	</div>
	<div class="refsection" id="id5528"><h2>A short but useful Example</h2>
	  
	  <div class="informalexample">
	    <p>The example below allows to apply the quoting rules of yabasic to user-input:</p>
	    <pre class="programlisting">
input "Please enter a string with some excape-sequences (e.g. \\r,\\n,\\t): " a$
print eval$("\"" + a$ + "\"")
            </pre>
	    <p>If the user types <strong class="userinput"><code>abc\ndef</code></strong> at the prompt, the text is echoed like this:</p>
	    <pre class="screen">
	      <code class="computeroutput">
		abc
		def
	      </code>
	    </pre>
	  </div>
	</div>
	<div class="refsection" id="id5539"><h2>A longer Example</h2>
	  
	  <div class="informalexample">
	    <p>The next example shows the subroutine <code class="function">evemex$</code> (for <span class="emphasis"><em>eval embedded expression</em></span>) that allows to embed expressions into a string, simply by enclosing them with <code class="literal">{{</code> and <code class="literal">}}</code>:</p>
	    <pre class="programlisting">

input "Please enter your name: " name$
print evemex$("Hello {{name$}}, your name has {{len(name$)}} characters.")


sub evemex$(evemex_str$)

  local evemex_pos1, evemex_pos2, evemex_res$

  evemex_pos1 = 1 
  evemex_pos2 = 1 
  evemex_res$ = ""
  	
  while (evemex_pos1 &lt; len(evemex_str$))
    if (mid$(evemex_str$, evemex_pos1, 2) = "{{") then
      evemex_res$ = evemex_res$ + mid$(evemex_str$, evemex_pos2, evemex_pos1 - evemex_pos2)
      evemex_pos1 = evemex_pos1 + 2
      evemex_pos2 = evemex_pos1
      while (evemex_pos2 &lt; len(evemex_str$))
        if (mid$(evemex_str$, evemex_pos2, 2) = "}}") then
           rem 
           rem  See the use of eval in the next line
           rem
	   evemex_res$ = evemex_res$ + eval$("str$(" + mid$(evemex_str$, evemex_pos1, evemex_pos2 - evemex_pos1) + ")")
	   evemex_pos2 = evemex_pos2 + 2
	   evemex_pos1 = evemex_pos2
	   break
	else
	  evemex_pos2 = evemex_pos2 + 1
	endif
      wend
    else
      evemex_pos1 = evemex_pos1 + 1
    endif
  wend

  evemex_res$ = evemex_res$ + mid$(evemex_str$, evemex_pos2, evemex_pos1 - evemex_pos2 + 1)	
  return evemex_res$

end sub
            </pre>
	    <p>If the user when prompted types <strong class="userinput"><code>Marc</code></strong>, he is greeted with <code class="computeroutput">Hello Marc, your name has 4 characters.</code> The program uses <code class="function">eval$</code> only once, and it adds <code class="function"><a class="link" href="#ref_str" title="str$()">str$</a></code> around the embedded expression to ensure, that the result is always a string and can be concatenated with the other strings.</p>
	    <p>Please note, that the subroutine prefixes its local variables with <code class="function">evemex</code> (for <span class="emphasis"><em>eval embedded expression</em></span>) to avoid name clashes with any variable that might be used in expressions within the string passed.</p>
	  </div>
	</div>
	<div class="refsection" id="id5559"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_add_code" title="Adding code to a running program">adding code during execution</a>, <code class="function"><a class="link" href="#ref_eval" title="eval()">eval</a></code>, <code class="function"><a class="link" href="#ref_compile" title="compile">compile</a></code>, <code class="function"><a class="link" href="#ref_execute" title="execute()">execute</a></code>, <code class="function"><a class="link" href="#ref_execute2" title="execute$()">execute$</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_execute"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  execute()
	   &#8212; execute a user defined subroutine, which must return a number
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">print execute("bar","arg1","arg2")</pre>
	</div>
	<div class="refsection" id="id5581"><h2>Description</h2>
	  
	  <p>The <code class="function">execute</code>-function is the counterpart of the <code class="function"><a class="link" href="#ref_execute2" title="execute$()">execute$</a></code>-function (please see there for some caveats). <code class="function">execute</code> may be used to execute subroutines, which return a number.</p>
	</div>
	<div class="refsection" id="id5590"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print execute("bar",2,3)
sub bar(a,b)
  return a+b
end sub
            </pre>
	    <p>This example would print out <code class="computeroutput">5</code>.</p>
	  </div>
	</div>
	<div class="refsection" id="id5598"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_add_code" title="Adding code to a running program">adding code during execution</a>, <code class="function"><a class="link" href="#ref_compile" title="compile">compile</a></code>, <code class="function"><a class="link" href="#ref_execute2" title="execute$()">execute$</a></code>, <code class="function"><a class="link" href="#ref_eval" title="eval()">eval</a></code>, <code class="function"><a class="link" href="#ref_eval2" title="eval$()">eval$</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_execute2"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  execute$()
	   &#8212; execute a user defined subroutine, which must return a string
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">print execute$("foo$","arg1","arg2")</pre>
	</div>
	<div class="refsection" id="id5620"><h2>Description</h2>
	  
	  <p><code class="function">execute$</code> can be used to execute a user defined subroutine, whose name is specified as a string expression.</p>
	  <p>This function allows to execute a subroutine, whose name is not known by the time you write your program. This might happen, if you want to execute a subroutine, which is compiled (using the <code class="function"><a class="link" href="#ref_compile" title="compile">compile</a></code> command) as late as of execution of your program.</p>
	  <p>Note however, that the <code class="function">execute$</code>-function is <span class="emphasis"><em>not</em></span> the preferred method to execute a user defined subroutine; in almost all cases you should just execute a subroutine by writing down its name within your yabasic program (see the example below).</p>
	</div>
	<div class="refsection" id="id5632"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print execute$("foo$","Hello","world !")
sub foo$(a$,b$)
  return a$+" "+b$
end sub
          </pre>
	    <p>The example simply prints <code class="computeroutput">Hello world !</code>, which is the return value of the user defined subroutine <code class="function">foo$</code>. The same could be achieved by executing:</p>
	    <pre class="programlisting">
print foo$(a$,b$)
	    </pre>
	    <p>So this example does not really <span class="emphasis"><em>need</em></span> the <code class="function">execute$</code>-function; see <code class="function"><a class="link" href="#ref_compile" title="compile">compile</a></code> for examples, that <span class="emphasis"><em>do</em></span>.</p>
	  </div>
	</div>
	<div class="refsection" id="id5648"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_add_code" title="Adding code to a running program">adding code during execution</a>, <code class="function"><a class="link" href="#ref_compile" title="compile">compile</a></code>, <code class="function"><a class="link" href="#ref_execute2" title="execute$()">execute$</a></code>, <code class="function"><a class="link" href="#ref_eval" title="eval()">eval</a></code>, <code class="function"><a class="link" href="#ref_eval2" title="eval$()">eval$</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_exit"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  exit
	   &#8212; terminate your program
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
exit
exit 1
</pre>
	</div>
	<div class="refsection" id="id5670"><h2>Description</h2>
	  
	  <p>Terminate your program and return any given value to the operating system. <code class="function">exit</code> is similar to <code class="function"><a class="link" href="#ref_end" title="end">end</a></code>, but it will terminate your program immediately, no matter what.</p>
	</div>
	<div class="refsection" id="id5678"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "Do you want to continue ?"
input "Please answer y(es) or n(o): " a$
if (lower$(left$(a$,1))="n") exit 1
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id5684"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_end" title="end">end</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_exp"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  exp()
	   &#8212; compute the exponential function of its single argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
foo=exp(bar)
</pre>
	</div>
	<div class="refsection" id="id5699"><h2>Description</h2>
	  
	  <p>This function computes <span class="emphasis"><em>e</em></span> to the power of its argument, where <span class="emphasis"><em>e</em></span> is the well known euler constant <code class="function">2.71828182864</code>.</p>
	  <p>The <code class="function">exp</code>-function is the inverse of the <code class="function">log</code>-function.</p>
	</div>
	<div class="refsection" id="id5710"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 100,100
for x=0 to 100
   dot x,100-100*exp(x/100)/euler
next x
          </pre>
	    <p>This program plots part of the <code class="function">exp</code>-function, however the range is rather small, so that you may not recognize the function from this plot.</p>
	  </div>
	</div>
	<div class="refsection" id="id5718"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_log" title="log()">log</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_export"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  export
	   &#8212; mark a function as globally visible
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
export sub foo(bar)
&#8230;
end sub
</pre>
	</div>
	<div class="refsection" id="id5733"><h2>Description</h2>
	  
	  <p>The <code class="function">export</code>-statement is used within libraries to mark a user defined subroutine as visible outside the library wherein it is defined. Subroutines, which are not exported, must be qualified with the name of the library, e.g. <code class="function">foo.baz</code> (where <code class="function">foo</code> is the name of the library and <code class="function">baz</code> the name of the subroutine); <span class="emphasis"><em>exported</em></span> subroutines may be used without specifying the name of the library, e.g. <code class="function">bar</code>.</p>
	  <p>Therefore <code class="function">export</code> may only be useful within libraries.</p>
	</div>
	<div class="refsection" id="id5746"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <p>The library <code class="filename">foo.bar</code> (which is listed below) defines two functions <code class="function">bar</code> and <code class="function">baz</code>, however only the function <code class="function">bar</code> is <span class="emphasis"><em>exported</em></span> and therefore visible even outside the library; <code class="function">baz</code> is <span class="emphasis"><em>not</em></span> exported and may only be used within the library <code class="computeroutput">foo.yab</code>:</p>
	    <pre class="programlisting">
export sub bar()
  print "Hello"
end sub

sub baz()
  print "World"
end sub
          </pre>
	    <p>Now within your main program <code class="filename">cux.yab</code> (which <code class="function"><a class="link" href="#ref_import" title="import">import</a></code>s the library foo.yab); note that this program produces an error:</p>
	    <pre class="programlisting">
import foo

print "Calling subroutine foo.bar (okay) ..."
foo.bar()
print "done."

print "Calling subroutine bar (okay) ..."
bar()
print "done."

print "Calling subroutine foo.baz (okay) ..."
foo.baz()
print "done."

print "Calling subroutine baz (NOT okay) ..."
baz()
print "done."

</pre>
	    <p>The output when executing <span class="command"><strong>yabasic foo.yab</strong></span> is this:</p>
	    <pre class="programlisting">
Calling subroutine foo.bar (okay) ...
Hello
done.
Calling subroutine bar (okay) ...
Hello
done.
Calling subroutine foo.baz (okay) ...
World
done.
Calling subroutine baz (NOT okay) ...
---Error in main.yab, line 16: can't find subroutine 'baz'
---Dump: sub baz() called in main.yab,16
---Error: Program stopped due to an error
</pre>
	    <p>As the error message above shows, the subroutine <code class="function">baz</code> must be qualified with the name of the library, if used outside the library, wherein it is defined (e.g. <code class="function">foo.baz</code>). I.e. outside the library <code class="filename">foo.yab</code> you need to write <code class="filename">foo.baz</code>. <code class="function">baz</code> alone would be an error.</p>
	    
	    <p>The subroutine <code class="function">bar</code> (without adding the name of the library) however may (and probably should) be used in any program, which imports the library <code class="filename">foo.yab</code>.</p>
	</div>
	<div class="note"><h3 class="title">Note</h3>
	  <p>In some sense the set of exported subroutines constitutes the <span class="emphasis"><em>interface</em></span> of a library.</p>
	</div>
	</div>
	<div class="refsection" id="id5781"><h2>See also</h2>
	  
	  <p><a class="link" href="#top_lib" title="Libraries">Libraries</a>, <code class="function"><a class="link" href="#ref_sub" title="sub">sub</a></code>, <code class="function"><a class="link" href="#ref_import" title="import">import</a></code></p>
	</div>
      </div>
    </section>

    <section class="section" id="ref_f"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F</h2></div></div></div>
      

      <div class="refentry" id="ref_false"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  false
	   &#8212; a constant with the value of 0
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
okay=false
</pre>
	</div>
	<div class="refsection" id="id5803"><h2>Description</h2>
	  
	  <p>The constant <code class="function">false</code> can be assigned to variables which later appear in conditions (e.g. within an <code class="function">if</code>-statement.</p>
	  <p><code class="function">false</code> may also be written as <code class="function">FALSE</code> or even <code class="function">FaLsE</code>.</p>
	</div>
	<div class="refsection" id="id5814"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a number between 1 and 10: " a
if (check_input(a)) print "Okay"

sub check_input(x)
  if (x&gt;10 or x&lt;1) return false
  return true
end sub
          </pre>
	    <p>The subroutine <code class="function">check_input</code> checks its argument and returns <code class="function">true</code> or <code class="function">false</code> according to the outcome of the check..</p>
	  </div>
	</div>
	<div class="refsection" id="id5824"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_true" title="true">true</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_fi"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  fi
	   &#8212; another name for <code class="function"><a class="link" href="#ref_endif" title="endif">endif</a></code>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
if (&#8230;)
&#8230;
fi
</pre>
	</div>
	<div class="refsection" id="id5841"><h2>Description</h2>
	  
	  <p><code class="function">fi</code> marks the end of an <code class="function">if</code>-statement and is exactly equivalent to <code class="function"><a class="link" href="#ref_endif" title="endif">endif</a></code>, please see there for further information.</p>
	</div>
	<div class="refsection" id="id5850"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "A number please: " a
if (a&lt;10) then
  print "Your number is less than 10."
fi
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id5856"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_endif" title="endif">endif</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_fill"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  fill
	   &#8212; draw a filled <code class="function">circle</code>s, <code class="function">rectangle</code>s or <code class="function">triangle</code>s
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
fill rectangle 10,10,90,90
fill circle 50,50,20
fill triangle 10,20,20,10,20,20
</pre>
	</div>
	<div class="refsection" id="id5874"><h2>Description</h2>
	  
	  <p>The keyword <code class="function">fill</code> may be used within the <code class="function"><a class="link" href="#ref_circle" title="circle">circle</a></code>, <code class="function"><a class="link" href="#ref_rectangle" title="rectangle">rectangle</a></code> or <code class="function"><a class="link" href="#ref_triangle" title="triangle">triangle</a></code> command and causes these shapes to be filled.</p>
	  <p><code class="function">fill</code> can be used in conjunction with and wherever the <code class="function"><a class="link" href="#ref_clear" title="clear">clear</a></code>-clause may appear. Used alone, <code class="function">fill</code> will fill the interior of the shape (circle, rectangle or triangle); together with <code class="function">clear</code> the whole shape (including its interior) is erased.</p>
	</div>
	<div class="refsection" id="id5892"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
fill circle 100,100,50
clear fill rectangle 10,10,90,90
          </pre>
	    <p>This opens a window and draws a pacman-like figure.</p>
	  </div>
	</div>
	<div class="refsection" id="id5899"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_clear" title="clear">clear</a></code>, <code class="function"><a class="link" href="#ref_circle" title="circle">circle</a></code>, <code class="function"><a class="link" href="#ref_rectangle" title="rectangle">rectangle</a></code>, <code class="function"><a class="link" href="#ref_triangle" title="triangle">triangle</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_floor"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  floor()
	   &#8212; compute the floor for its (float) argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print floor(x)
</pre>
	</div>
	<div class="refsection" id="id5920"><h2>Description</h2>
	  
	  <p>The <code class="function">floor</code>-function returns the largest integer number, that is smaller or equal than its argument. For positive numbers <code class="literal">x</code>, <code class="literal">floor(x)</code> is the same as <code class="function">int(x)</code>; for negaive numbers it can be different (see the example below).</p>
	</div>
	<div class="refsection" id="id5929"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print int(-1.5),floor(-1.5)
print int(-1),floor(-1)
print int(1.5),floor(1.5)
          </pre>
	    <p>This example compares the functions <code class="function">int</code> and <code class="function">floor</code>, starting with <code class="computeroutput">-1 -2</code>, then <code class="computeroutput">-1 -1</code> and ending with <code class="computeroutput">1 1</code>, which shows the different behaviour of both functions.</p>
	  </div>
	</div>
	<div class="refsection" id="id5941"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_ceil" title="ceil()">ceil</a></code>, <code class="function"><a class="link" href="#ref_int" title="int()">int</a></code>, <code class="function"><a class="link" href="#ref_frac" title="frac()">frac</a></code>, <code class="function"><a class="link" href="#ref_round" title="round()">round</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_for"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  for
	   &#8212; starts a <code class="function">for</code>-loop
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
for a=1 to 100 step 2
  &#8230;
next a
</pre>
	</div>
	<div class="refsection" id="id5963"><h2>Description</h2>
	  
	  <p>The <code class="function">for</code>-loop lets its numerical variable (<code class="function">a</code> in the synopsis) assume all values within the given range. The optional <code class="function">step</code>-clause may specify a value (default: 1) by which the variable will be incremented (or decremented, if <code class="function">step</code> is negative).</p>
	  <p>Any <code class="function">for</code>-statement can be replaced by a set of <code class="function">if</code>s and <code class="function">goto</code>s; as you may infer from the example below this is normally not feasible. However if you want to know in detail how the <code class="function">for</code>-statement works, you should study this example, which presents a <code class="function">for</code>-statement and an <span class="emphasis"><em>exactly equivalent</em></span> series of <code class="function">if</code>s and <code class="function">goto</code>s.</p>
	</div>
	<div class="refsection" id="id5981"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=1 to 10 step 2:print a:next 

a=1
label check
if (a&gt;10) goto done
  print a
  a=a+2
goto check
label done
          </pre>
	    <p>This example simply prints the numbers 1, 3, 5, 7 and 9. It does this twice: First with a simple <code class="function">for</code>-statement and then with <code class="function">if</code>s and <code class="function">goto</code>s.</p>
	  </div>
	</div>
	<div class="refsection" id="id5991"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_step" title="step">step</a></code>, <code class="function"><a class="link" href="#ref_next" title="next">next</a></code></p>
	</div>
      </div>


      <div class="refentry" id="ref_foreign_buffer_alloc"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  foreign_buffer_alloc$()
	   &#8212; Create a new buffer for use in a foreign function call
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
handle$=foreign_buffer_alloc$(10)
</pre>
	</div>
	<div class="refsection" id="id6008"><h2>Description</h2>
	  
	  <p><code class="function">foreign_buffer_alloc$()</code> creates a new buffer of specified size (using the <span class="application">C</span>-function <code class="function">malloc</code>). This buffer can then be populated by <code class="function"><a class="link" href="#ref_foreign_buffer_set" title="foreign_buffer_set">foreign_buffer_set</a></code> or <code class="function"><a class="link" href="#ref_foreign_buffer_set_buffer" title="foreign_buffer_set_buffer">foreign_buffer_set_buffer</a></code>, passed to <code class="function"><a class="link" href="#ref_foreign_function_call" title="foreign_function_call()">foreign_function_call</a></code> and finally freed with <code class="function"><a class="link" href="#ref_foreign_buffer_free" title="foreign_buffer_free">foreign_buffer_free</a></code>.</p>
	  <p>The special value of <code class="literal">-1</code> can be passed to create the equivalent of a <span class="emphasis"><em>null-pointer</em></span> in C: when your <span class="application">yabasic</span>-program passes such a buffer to an external function, it is replaced by a null-pointer.</p>
        </div>
	<div class="refsection" id="id6028"><h2>See also</h2>
	  
	  <p>The <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview-section on foreign functions</a>, <a class="link" href="#top_ffi" title="The foreign function interface">list of related functions and commands</a></p>
	</div>
      </div>

 
      <div class="refentry" id="ref_foreign_buffer_dump"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  foreign_buffer_dump$()
	   &#8212; return the content of a buffer as a hex-encoded string
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
	    print foreign_buffer_dump(handle$)
</pre>
	</div>
	<div class="refsection" id="id6043"><h2>Description</h2>
	  
	  <p><code class="function">foreign_buffer_dump$()</code> is mostly used during development of your <span class="application">yabasic</span> program and helps to investigate the content of a buffer; this can be helpful to find out, how a structure for a foreign function call is aggregated. To actually retrieve elements from the structure rather use <code class="function"><a class="link" href="#ref_foreign_buffer_get" title="foreign_buffer_get()">foreign_buffer_get</a></code>.</p>
        </div>
	<div class="refsection" id="id6052"><h2>See also</h2>
	  
	  <p>The <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview-section on foreign functions</a>, <a class="link" href="#top_ffi" title="The foreign function interface">list of related functions and commands</a></p>
	</div>
      </div>

 
      <div class="refentry" id="ref_foreign_buffer_free"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  foreign_buffer_free
	   &#8212; free a foreign buffer
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
foreign_buffer_free handle$
</pre>
	</div>
	<div class="refsection" id="id6067"><h2>Description</h2>
	  
	  <p><code class="function">foreign_buffer_free()</code> expects a handle for a buffer and frees this buffer (using the <span class="application">C</span>-function <code class="function">free</code>), i.e. gives this memory area back to the operating system. Any subsequent attempt to access part of this buffer (e.g. via <code class="function"><a class="link" href="#ref_foreign_buffer_get" title="foreign_buffer_get()">foreign_buffer_get</a></code>) will probably lead to an error (as will a second call to <code class="function">foreign_buffer_free()</code>). The handle-argument must have been returned previously by <code class="function"><a class="link" href="#ref_foreign_buffer_alloc" title="foreign_buffer_alloc$()">foreign_buffer_alloc</a></code> or <code class="function"><a class="link" href="#ref_foreign_function_call" title="foreign_function_call()">foreign_function_call</a></code>.</p>
        </div>
	<div class="refsection" id="id6082"><h2>See also</h2>
	  
	  <p>The <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview-section on foreign functions</a>, <a class="link" href="#top_ffi" title="The foreign function interface">list of related functions and commands</a></p>
	</div>
      </div>

 
      <div class="refentry" id="ref_foreign_buffer_get"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  foreign_buffer_get()
	   &#8212; extract a number from a foreign buffer
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print foreign_buffer_get(handle$,10,"int")
</pre>
	</div>
	<div class="refsection" id="id6097"><h2>Description</h2>
	  
	  <p><code class="function">foreign_buffer_get()</code> retrieves a simple type from a buffer, that is assumed to contain a structure (see the <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview-section</a> for the necessary background). For this it needs three arguments:</p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>A handle to a buffer, that has been previously filled, e.g. by a foreign function call.</p>
	    </li><li class="listitem">
	      <p>An offset, counted in bytes from the start of the buffer, which specifies where the value can be found within the structure.</p>
	    </li><li class="listitem">
	      <p>A string, specifying the type of the value that should be retrieved, which for this function is always an integer type like <code class="literal">"int"</code>, <code class="literal">"short"</code> or <code class="literal">"long"</code>.</p>
	    </li></ul></div>
	  <p>Correct usage of this function requires an good understanding of the respective structure contained within the buffer.</p>
	</div>
	<div class="refsection" id="id6115"><h2>See also</h2>
	  
	  <p>The <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview-section on foreign functions</a>, <a class="link" href="#top_ffi" title="The foreign function interface">list of related functions and commands</a>, the neighbouring functions for retrieving other values from the buffer.</p>
	</div>
      </div>

 
      <div class="refentry" id="ref_foreign_buffer_get2"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  foreign_buffer_get$()
	   &#8212; extract a string from a foreign buffer
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print foreign_buffer_get$(handle$,0,12)
</pre>
	</div>
	<div class="refsection" id="id6130"><h2>Description</h2>
	  
	  <p><code class="function">foreign_buffer_get$()</code> retrieves a string from a foreign buffer; its areguments are</p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>A handle to a buffer, that has been previously filled, e.g. by a foreign function call.</p>
	    </li><li class="listitem">
	      <p>An offset within this buffer, where the string starts. In the common case, where the buffer can be assumed to contain a string <span class="emphasis"><em>only</em></span>, this offset should be 0.</p>
	    </li><li class="listitem">
	      <p>The maximum length of the expected string. This is a value not necessarily known but if the string is null-terminated (as usual) you may just specify a much larger number here.</p>
	    </li></ul></div>
	  <p>Correct usage of this function requires an good understanding of the respective structure contained within the buffer.</p>
        </div>
	<div class="refsection" id="id6145"><h2>See also</h2>
	  
	  <p>The <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview-section on foreign functions</a>, <a class="link" href="#top_ffi" title="The foreign function interface">list of related functions and commands</a></p>
	</div>
      </div>

 
      <div class="refentry" id="ref_foreign_buffer_get_buffer"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  foreign_buffer_get_buffer()
	   &#8212; take a buffer and construct a handle to a second buffer from its content
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
handle2$ = foreign_buffer_get_buffer(handle$,8)
</pre>
	</div>
	<div class="refsection" id="id6160"><h2>Description</h2>
	  
	  <p><code class="function">foreign_buffer_get_buffer()</code> should be used, if a buffer (i.e. the contained structure) is known to contain a <span class="emphasis"><em>pointer</em></span> to a string or another structure. <code class="function">foreign_buffer_get_buffer()</code> then reads this pointer and transforms it into a handle, that can then be used by other functions from the <code class="function">foreign_buffer_get</code>-family. The two arguments are:</p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>A handle to a buffer, that has been previously filled, e.g. by a foreign function call.</p>
	    </li><li class="listitem">
	      <p>An offset within the buffer to the start of the buffer. A (third) length-argument is not required, because typically all pointers on a platform have the same length.</p>
	    </li></ul></div>
	  <p>See the <span class="application">libcurl</span>-example in the overview-section for an example.</p>
        </div>
	<div class="refsection" id="id6176"><h2>See also</h2>
	  
	  <p>The <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview-section on foreign functions</a>, <a class="link" href="#top_ffi" title="The foreign function interface">list of related functions and commands</a></p>
	</div>
      </div>

 
      <div class="refentry" id="ref_foreign_buffer_set"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  foreign_buffer_set
	   &#8212; store a given value within a buffer
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
foreign_buffer_set handle$,4,"Hello World"
foreign_buffer_set handle$,6,"long",42
</pre>
	</div>
	<div class="refsection" id="id6191"><h2>Description</h2>
	  
	  <p><code class="function">foreign_buffer_set</code> can be used to populate a structure within a foreign buffer. It accepts strings (first line in synopsis) and numbers (second line in synopsis) and stores them at the given offset. The arguments are:</p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>A handle to a buffer, that might have been just allocated or been returned from a foreign function call.</p>
	    </li><li class="listitem">
	      <p>An offset, specifying the first byte where the given data will be stored.</p>
	    </li><li class="listitem">
	      <p>The third argument: If you want to store a string, specify it just here; if you want to store a number, specify its type (e.g. <code class="literal">int</code>).</p>
	    </li><li class="listitem">
	      <p>A fourth argument is only needed, when you want to store a number; this number needs then to be given here.</p>
	    </li></ul></div>
        </div>
	<div class="refsection" id="id6207"><h2>See also</h2>
	  
	  <p>The <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview-section on foreign functions</a>, <a class="link" href="#top_ffi" title="The foreign function interface">list of related functions and commands</a></p>
	</div>
      </div>

 
      <div class="refentry" id="ref_foreign_buffer_set_buffer"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  foreign_buffer_set_buffer
	   &#8212; store a pointer to one buffer within another buffer
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
foreign_buffer_set handle1$,16,handle2$
</pre>
	</div>
	<div class="refsection" id="id6222"><h2>Description</h2>
	  
	  <p><code class="function">foreign_buffer_set_buffer</code> stores a pointer (as in <span class="application">C</span>) to a buffer within another buffer. It accepts a handle to a buffer (<code class="literal">handle2$</code> in the synopsis) and stores it as a pointer at the given offset within the buffer given first (<code class="literal">handle1$</code>). The arguments are:</p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>A handle to a buffer, that might have been just allocated or been returned from a foreign function call.</p>
	    </li><li class="listitem">
	      <p>An offset, specifying the first byte where the pointer to the given buffer will be stored.</p>
	    </li><li class="listitem">
	      <p>A handle to a buffer whose address (pointer) will be stored within the first buffer.</p>
	    </li></ul></div>
        </div>
	<div class="refsection" id="id6238"><h2>See also</h2>
	  
	  <p>The <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview-section on foreign functions</a>, <a class="link" href="#top_ffi" title="The foreign function interface">list of related functions and commands</a></p>
	</div>
      </div>

 
      <div class="refentry" id="ref_foreign_buffer_size"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  foreign_buffer_size()
	   &#8212; return the size of the foreign buffer
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
size = foreign_buffer_size(handle$)
</pre>
	</div>
	<div class="refsection" id="id6253"><h2>Description</h2>
	  
	  <p>Return the size of the given buffer; if your handle just encapsulates a null-pointer, this will return 0; if the size is not known (standard for buffers returned from a foreign function call), the size will be -1.</p>
        </div>
	<div class="refsection" id="id6258"><h2>See also</h2>
	  
	  <p>The <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview-section on foreign functions</a>, <a class="link" href="#top_ffi" title="The foreign function interface">list of related functions and commands</a></p>
	</div>
      </div>


      <div class="refentry" id="ref_foreign_function_call"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  foreign_function_call()
	   &#8212; call a function (returning a number) from a non-<span class="application">yabasic</span> library or dll
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print foreign_function_call("libtimestwo","int","timestwo","int",3)
</pre>
	</div>
	<div class="refsection" id="id6274"><h2>Description</h2>
	  
	  <p><code class="function">foreign_function_call</code> calls a function from an external library.</p>
	  <p>In general, this feature is mostly useful, if you have such a library written or aquired. If you have an external command, that can be called interactively (i.e. from the commandline), you might try the <code class="function"><a class="link" href="#ref_system" title="system()">system</a></code>-function.</p>
	  <p>Please see the <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview-section on foreign functions</a> for overview, background and more examples. For details on functionality and arguments see below.</p>
	<p>The example uses the <code class="function">foreign_function_call</code> to invoke the <code class="function">cos</code>-function from the standard <span class="application">C</span>-library (<code class="filename">libm.so.6</code> under Unix or <code class="filename">msvcrt.dll</code> under Windows).</p>	</div>
	  <div class="refsection" id="id6291"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
if peek$("os") = "unix" then
  lib$ = "libm.so.6"
else
  lib$ = "msvcrt.dll"
fi
print foreign_function_call(lib$,"double","cos","double",2)	      
          </pre>	  
	  </div>
	  <p>The <code class="function">foreign_function_call</code>-function accepts a variable number of arguments; 3 at minimum, 5 in the example above:</p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>A string, containing the name of the library, e.g. <code class="literal">"libm.so.6"</code>.</p>
	    </li><li class="listitem">
	      <p>A string describing the type, that the function (specified with the next argument) returns (in the example: <code class="literal">"double"</code>). See below for a list of all such types.</p>
	    </li><li class="listitem">
	      <p>The name of the function, that should be called (in the example above: <code class="literal">"cos"</code>)</p>
	    </li></ul></div>
	  <p>If the external function does not require arguments itself, the three arguments above are everything needed for <code class="function">foreign_function_call</code>. However (as for  <code class="function">cos</code>), if the external function itself requires arguments, than for each of its arguments, two more arguments are needed <code class="function">foreign_function_call</code>:</p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>A string describing the <span class="emphasis"><em>type</em></span> of the parameter to the external function (in the example: <code class="literal">"double"</code>). See the <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview-section on foreign functions</a> for a list of all such types.</p>
	    </li><li class="listitem">
	      <p>A value, that can be converted to the specified type (in the example: <code class="literal">2</code>).</p>
	    </li></ul></div>
	  <p>With all these arguments specified, <span class="application">yabasic</span> will call the foreign function (in the example: <code class="literal">cos</code>) and return its result; this process can be influenced by specifying <span class="emphasis"><em>options</em></span> (see below).</p>
	</div>
	<div class="refsection" id="id6326"><h2>Options</h2>
	  
	  <p>Options can be appended in any number after the string <code class="literal">"options"</code>, e.g. like:</p>
	  <div class="informalexample">
	    <pre class="programlisting">
	      foreign_function_call(lib$,"double","cos","double",2,"options","error")
	    </pre>
	  </div>
	  <p>Each option can be preceded with the string <code class="literal">no_</code> to invert its meaning. As given below (i.e. with or without <code class="literal">no_</code>) the values represent the respective default.</p>
	  <div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">error</code></span></dt><dd>
		<p>In case of errors (e.g. if a library cannot be found), should the function report them actively (which terminates your <span class="application">yabasic</span>-program) ? Or should the error silently stored away for later retrieval by <code class="function"><a class="link" href="#ref_peek" title="peek">peek("last_foreign_function_call_okay")</a></code> and <code class="function"><a class="link" href="#ref_peek2" title="peek$">peek$("last_foreign_function_call_error_text")</a></code> ?</p>
	      </dd><dt><span class="term"><code class="literal">no_copy_string_result</code></span></dt><dd>
		<p>If the foreign function returns a string-value (like <code class="literal">strstr</code>), it should be invoked using <code class="function"><a class="link" href="#ref_foreign_function_call2" title="foreign_function_call$()">foreign_function_call$</a></code>, which returns a string. Now, depending on the foreign function invoked, it might be necessary to make a copy of its result before returning it to <span class="application">yabasic</span>. In the case of <code class="literal">strstr</code> this is needed, because it returns just a pointer to part of its input string which will <span class="application">yabasic</span> happily free later on, probably leading to a segfault after.</p>
	      </dd><dt><span class="term"><code class="literal">no_unload_library</code></span></dt><dd>
		<p>Normally, after making a call to a foreign function, the named library is kept in memory for further use (see <a class="link" href="#background_ffi" title="Some Background">background</a>). However, sometimes you might want to dismiss the library right after the call; then you may specify this option.</p>
	      </dd></dl></div>
	</div>
	<div class="refsection" id="id6365"><h2>See also</h2>
	  
	  <p>The <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview-section on foreign functions</a>, <a class="link" href="#top_ffi" title="The foreign function interface">list of related functions and commands</a>, <code class="function"><a class="link" href="#ref_system" title="system()">system</a></code></p>
	</div>
      </div>

      
      <div class="refentry" id="ref_foreign_function_call2"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  foreign_function_call$()
	   &#8212; call a function (returning a string or a buffer) from a non-<span class="application">yabasic</span> library or dll
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
a$=foreign_function_call$("libupper","string","toupper","string","hello world")	    
</pre>
	</div>
	<div class="refsection" id="id6383"><h2>Description</h2>
	  
	  <p>This function calls a function from an external library, just like <code class="function"><a class="link" href="#ref_foreign_function_call" title="foreign_function_call()">foreign_function_call</a></code> (which see for most of the description). The only difference is that <code class="function">foreign_function_call$</code> should be used when the foreign function returns a string or a structure (which itself is contained in a buffer, which is represented by a handle, which is a string).</p>
	  <p>The arguments are just the same as in <code class="function"><a class="link" href="#ref_foreign_function_call" title="foreign_function_call()">foreign_function_call</a></code>, only the second argument (<code class="literal">"string"</code> in the example above) can only be <code class="literal">"string"</code> or <code class="literal">"buffer"</code> in accord to the nature of <code class="function">foreign_function_call$</code>, which itself must return a string.</p>
	  <p>Among the options described at <code class="function"><a class="link" href="#ref_foreign_function_call" title="foreign_function_call()">foreign_function_call</a></code>, the option <code class="literal">"copy_string_result"</code> can really only be applied here.</p>
        </div>
	<div class="refsection" id="id6402"><h2>See also</h2>
	  
	  <p>The <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview-section on foreign functions</a>, <a class="link" href="#top_ffi" title="The foreign function interface">list of related functions and commands</a></p>
	</div>
      </div>

 
      <div class="refentry" id="ref_foreign_function_size"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  foreign_function_size()
	   &#8212; return the size of one of the types available for foreign function calls
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
offset=foreign_function_size("short")
</pre>
	</div>
	<div class="refsection" id="id6417"><h2>Description</h2>
	  
	  <p>The function returns the size of any of the types available for calls to foreign functions (see the <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview section</a> for a complete list). This is useful when calculating offsets needed for <code class="function"><a class="link" href="#ref_foreign_buffer_set" title="foreign_buffer_set">foreign_buffer_set</a></code> or <code class="function"><a class="link" href="#ref_foreign_buffer_get" title="foreign_buffer_get()">foreign_buffer_get</a></code>.</p>
        </div>
	<div class="refsection" id="id6427"><h2>See also</h2>
	  
	  <p>The <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview section on foreign functions</a>, <a class="link" href="#top_ffi" title="The foreign function interface">list of related functions and commands</a></p>
	</div>
      </div>

      
      <div class="refentry" id="ref_frn"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  frnbf_ and frnfn_
	   &#8212; Abbreviations for <code class="literal">foreign_buffer_</code> and <code class="literal">foreign_function_</code>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print frnfn_size("short")
</pre>
	</div>
	<div class="refsection" id="id6444"><h2>Description</h2>
	  
	  <p>The abbreviations <code class="literal">frnbf_</code> and <code class="literal">frnfn_</code> are just short for <code class="literal">foreign_buffer_</code> and <code class="literal">foreign_function_</code>; you might prefer one over the other; in any case a good editor should make it easy to replace the short form with the long one.</p>
        </div>
	<div class="refsection" id="id6453"><h2>See also</h2>
	  
	  <p>The <a class="link" href="#ffi" title="Interaction with functions from a non-yabasic library or dll">overview section on foreign functions</a>, <a class="link" href="#top_ffi" title="The foreign function interface">list of related functions and commands</a></p>
	</div>
      </div>

      
      <div class="refentry" id="ref_frac"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  frac()
	   &#8212; return the fractional part of its numeric argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
x=frac(y)
</pre>
	</div>
	<div class="refsection" id="id6468"><h2>Description</h2>
	  
	  <p>The <code class="function">frac</code>-function takes its argument, removes all the digits to the left of the comma and just returns the digits right of the comma, i.e. the fractional part.</p>
	  <p>Refer to the example to learn how to rewrite <code class="function">frac</code> by employing the <code class="function">int</code>-function (which is not suggested anyway).</p>
	</div>
	<div class="refsection" id="id6477"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=1 to 10
  print frac(sqr(a))
  print sqr(a)-int(sqr(a))
next a
          </pre>
	    <p>The example prints the fractional part of the square root of the numbers between 1 and 10. Each result is computed (and printed) twice: Once by employing the <code class="function">frac</code>-function and once by employing the <code class="function"><a class="link" href="#ref_int" title="int()">int</a></code>-function.</p>
	  </div>
	</div>
	<div class="refsection" id="id6487"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_int" title="int()">int</a></code>, <code class="function"><a class="link" href="#ref_floor" title="floor()">floor</a></code>, <code class="function"><a class="link" href="#ref_ceil" title="ceil()">ceil</a></code>, <code class="function"><a class="link" href="#ref_round" title="round()">round</a></code></p>
	</div>
      </div>
    </section>

    <section class="section" id="ref_g"><div class="titlepage"><div><div><h2 class="title" style="clear: both">G</h2></div></div></div>
      

      <div class="refentry" id="ref_getbit"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  getbit$()
	   &#8212; return a string representing the bit pattern of a rectangle within the graphic window
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
a$=getbit$(10,10,20,20)
a$=getbit$(10,10 to 20,20)
</pre>
	</div>
	<div class="refsection" id="id6512"><h2>Description</h2>
	  
	  <p>The function <code class="function">getbit</code> returns a string, which contains the encoded bit-pattern of a rectangle within graphic window; the four arguments specify two opposite corners of the rectangle. The string returned might later be fed to the <code class="function"><a class="link" href="#ref_putbit" title="putbit">putbit</a></code>-command. </p>
	  <p>The <code class="function">getbit$</code>-function might be used for simple animations (as in the example below).</p>
	</div>
	<div class="refsection" id="id6522"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 40,40
fill circle 20,20,18
circle$=getbit$(0,0,40,40)
close window

open window 200,200
for x=1 to 200
  putbit circle$,x,80
next x
          </pre>
	    <p>This example features a circle moving from left to right over the window.</p>
	  </div>
	</div>
	<div class="refsection" id="id6529"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_putbit" title="putbit">putbit</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_getscreen"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  getscreen$()
	   &#8212; returns a string representing a rectangular section of the text terminal
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
a$=getscreen$(2,2,20,20)
</pre>
	</div>
	<div class="refsection" id="id6544"><h2>Description</h2>
	  
	  <p>The <code class="function">getscreen$</code> function returns a string representing the area of the screen as specified by its four arguments (which specify two opposite corners). I.e. everything you have printed within this rectangle will be encoded in the string returned (including any colour-information).</p>	  
	  <p>Like most other commands dealing with advanced text output, <code class="function">getscreen$</code> requires, that you have called <code class="function">clear screen</code> before.</p>
	</div>
	<div class="refsection" id="id6553"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
clear screen

for a=1 to 1000:
	print color("red") "1";
	print color("green") "2";
	print color("blue") "3";
next a  
screen$=getscreen$(10,10,40,10)
print at(10,10) " Please Press 'y' or 'n' ! "
a$=inkey$
putscreen screen$,10,10
          </pre>
	    <p>This program fills the screen with colored digits and afterwards asks the user for a choice (<code class="computeroutput"> Please press 'y' or 'n' ! </code>). Afterwards the area of the screen, which has been overwritten by the question will be restored with its previous contents, whhch had been saved via <code class="function">getscreen$</code>.</p>
	  </div>
	</div>
	<div class="refsection" id="id6562"><h2>See also</h2>
	  
	  <p><code class="function">putscreen$</code></p>
	</div>
      </div>

      <div class="refentry" id="ref_glob"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  glob()
	   &#8212; check if a string matches a simple pattern
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
if (glob(string$,pattern$)) &#8230;
</pre>
	</div>
	<div class="refsection" id="id6576"><h2>Description</h2>
	  
	  <p>The <code class="function">glob</code>-function takes two arguments, a string and a (glob-) pattern, and checks if the string matches the pattern. However <code class="function">glob</code> does <span class="emphasis"><em>not</em></span> employ the powerful rules of regular expressions; rather it has only two <span class="emphasis"><em>special</em></span> characters: <code class="computeroutput">*</code> (which matches any number (even zero) of characters) and <code class="computeroutput">?</code> (which matches exactly a single character).</p>
	</div>
	<div class="refsection" id="id6587"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=1 to 10
  read string$,pattern$
  if (glob(string$,pattern$)) then
    print string$," matches ",pattern$
  else
    print string$," does not match ",pattern$
  endif
next a

data "abc","a*"
data "abc","a?"
data "abc","a??"
data "abc","*b*"
data "abc","*"
data "abc","???"
data "abc","?"
data "abc","*c"
data "abc","A*"
data "abc","????"
          </pre>
	    <p>This program checks the string <code class="computeroutput">abc</code> against various patterns and prints the result. The output is:</p>
	    <pre class="screen">
abc matches a*
abc does not match a?
abc matches a??
abc matches *b*
abc matches *
abc matches ???
abc does not match ?
abc matches *c
abc does not match A*
abc does not match ????
</pre>
	  </div>
	</div>
	<div class="refsection" id="id6596"><h2>See also</h2>
	  
	  <p>There are no related commands.</p>
	</div>
      </div>

      <div class="refentry" id="ref_gosub"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  gosub
	   &#8212; continue execution at another point within your program (and return later)
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
gosub foo

&#8230;

label foo
&#8230;
return
</pre>
	</div>
	<div class="refsection" id="id6609"><h2>Description</h2>
	  
	  <p><code class="function">gosub</code> remembers the current position within your program and then passes the flow of execution to another point (which is normally marked with a <code class="function"><a class="link" href="#ref_label" title="label">label</a></code>). Later, when a <code class="function">return</code>-statement is encountered, the execution is resumed at the previous location.</p>
	  <p><code class="function">gosub</code> is the traditional command for calling code, which needs to be executed from various places within your program. However, with <span class="emphasis"><em>subroutines</em></span> yabasic offers a much more flexible way to achieve this (and more). Therefore <code class="function">gosub</code> must to be considered obsolete.</p>
	</div>
	<div class="refsection" id="id6622"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "Do you want to exit ? "
gosub ask
if (r$="y") exit

label ask
input "Please answer yes or no, by typing 'y' or 'n': ",r$
return
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id6628"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_return" title="return">return</a></code>, <code class="function"><a class="link" href="#ref_goto" title="goto">goto</a></code>, <code class="function"><a class="link" href="#ref_sub" title="sub">sub</a></code>, <code class="function"><a class="link" href="#ref_label" title="label">label</a></code>, <code class="function"><a class="link" href="#ref_on_gosub" title="on gosub">on gosub</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_goto"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  goto
	   &#8212; continue execution at another point within your program (and never come back)
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
goto foo

&#8230;

label foo
</pre>
	</div>
	<div class="refsection" id="id6651"><h2>Description</h2>
	  
	  <p>The <code class="function">goto</code>-statement passes the flow of execution to another point within your program (which is normally marked with a <code class="function"><a class="link" href="#ref_label" title="label">label</a></code>).</p>
	  <p><code class="function">goto</code> is normally considered obsolete and harmful, however in yabasic it may be put to the good use of leaving loops (e.g. <code class="function">while</code> or <code class="function">for</code>) prematurely. Note however, that subroutines may <span class="emphasis"><em>not</em></span> be left with the <code class="function">goto</code>-statement.</p>
	</div>
	<div class="refsection" id="id6665"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "Please press any key to continue."
print "(program will continue by itself within 10 seconds)"
for a=1 to 10
  if (inkey$(1)&lt;&gt;"") then goto done
next a
label done
print "Hello World !"
          </pre>
	    <p>Here the <code class="function">goto</code>-statement is used to leave the <code class="function">for</code>-loop prematurely.</p>
	  </div>
	</div>
	<div class="refsection" id="id6674"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_gosub" title="gosub">gosub</a></code>, <code class="function"><a class="link" href="#ref_on_goto" title="on goto">on goto</a></code></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_h"><div class="titlepage"><div><div><h2 class="title" style="clear: both">H</h2></div></div></div>
      

      <div class="refentry" id="ref_hex"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  hex$()
	   &#8212; convert a number into hexadecimal
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print hex$(foo)
</pre>
	</div>
	<div class="refsection" id="id6695"><h2>Description</h2>
	  
	  <p>The <code class="function">hex$</code>-function converts a number into a string with its hexadecimal representation. <code class="function">hex$</code> is the inverse of the <code class="function">dec</code>-function.</p>
	</div>
	<div class="refsection" id="id6703"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open 1,"foo"
while !eof(1)
  print right$("0"+hex$(peek(1)),2)," ";
  i=i+1
  if (mod(i,10)=0) print
end while
print
          </pre>
	    <p>This program reads the file <code class="computeroutput">foo</code> and prints its output as a <span class="emphasis"><em>hex</em></span>-dump using the <code class="function">hex</code>-function.</p>
	  </div>
	</div>
	<div class="refsection" id="id6713"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_dec" title="dec()">dec</a></code><code class="function"><a class="link" href="#ref_bin" title="bin$()">bin</a></code>, <a class="link" href="#top_numbers_with_base_2_or_16" title="Numbers with base 2 or 16">numbers with base 2 or 16</a></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_i"><div class="titlepage"><div><div><h2 class="title" style="clear: both">I</h2></div></div></div>
      

      <div class="refentry" id="ref_if"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  if
	   &#8212; evaluate a condition and execute statements or not, depending on the result
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
if (&#8230;) then
  &#8230;
endif

if (&#8230;) &#8230;

if (&#8230;) then
  &#8230;
else
  &#8230;
endif

if (&#8230;) then
  &#8230;
elsif (&#8230;)
  &#8230;
elsif (&#8230;) then
  &#8230;
else
  &#8230;
endif
</pre>
	</div>
	<div class="refsection" id="id6735"><h2>Description</h2>
	  
	  <p>The <code class="function">if</code>-statement is used to evaluate a conditions and take actions accordingly. (As an aside, please note that there is no real difference between <a class="link" href="#ref_conditions_and_expressions" title="Conditions and expressions">conditions and expressions</a>.)</p>
	  <p>There are two major forms of the <code class="function">if</code>-statement:</p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>The <span class="emphasis"><em>one-line</em></span>-form <span class="emphasis"><em>without</em></span> the keyword <code class="function">then</code>: </p><pre class="programlisting">if (&#8230;) &#8230;</pre><p> This form evaluates the condition and if the result is <code class="constant">true</code> executes all commands (separated by colons) upt to the end of the line. There is neither an <code class="function">endif</code> keyword nor an <code class="function">else</code>-branch.</p>
	    </li><li class="listitem">
	      <p>The <span class="emphasis"><em>multi-line</em></span>-form <span class="emphasis"><em>with</em></span> the keyword <code class="function">then</code>: </p><pre class="programlisting">if (&#8230;) then &#8230; elsif (&#8230;) &#8230; else &#8230; endif</pre><p> (where <code class="function">elsif</code> and <code class="function">else</code> are optional, whereas <code class="function">endif</code> is not.</p>
	      <p>According to the requirements of your program, you may specify:</p>
	      <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">
		  <p><code class="function">elsif(&#8230;)</code>, which specifies a condition, that will be evaluated only if the condition(s) within <code class="function">if</code> or any preceding <code class="function">elsif</code> did not match.</p>
		</li><li class="listitem">
		  <p><code class="function">else</code>, which introduces a sequence of commands, that will be executed, if none of the conditions above did match. </p>
		</li><li class="listitem">
		  <p><code class="function">endif</code> is required and ends the <code class="function">if</code>-statement.</p>
		</li></ul></div>
	    </li></ul></div>
	</div>
	<div class="refsection" id="id6777"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a number between 1 and 4: " a
if (a&lt;=1 or a&gt;=4) error "Wrong, wrong !"
if (a=1) then
  print "one"
elsif (a=2)
  print "two"
elsif (a=3)
  print "three"
else
  print "four"
endif
          </pre>
	    <p>The input-number between 1 and 4 is simply echoed as text (<code class="computeroutput">one</code>, <code class="computeroutput">two</code>, &#8230;). The example demonstrates both forms (<span class="emphasis"><em>short</em></span> and <span class="emphasis"><em>long</em></span>) of the <code class="function">if</code>-statement (Note however, that the same thing can be done, probably somewhat more elegant, with the <code class="function">switch</code>-statement).</p>
	  </div>
	</div>
	<div class="refsection" id="id6790"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_else" title="else">else</a></code>, <code class="function"><a class="link" href="#ref_elsif" title="elsif">elsif</a></code>, <code class="function"><a class="link" href="#ref_endif" title="endif">endif</a></code>, <code class="function"><a class="link" href="#ref_conditions_and_expressions" title="Conditions and expressions">conditions and expressions</a></code>.</p>
	</div>
      </div>

      <div class="refentry" id="ref_import"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  import
	   &#8212; import a library
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
import foo
</pre>
	</div>
	<div class="refsection" id="id6811"><h2>Description</h2>
	  
	  <p>The <code class="function">import</code>-statement imports a library. It expects a single argument, which must be the name of a library (without the trailing <code class="computeroutput">.yab</code>). This library will then be read and parsed and its subroutines (and variables) will be made available within the importing program. Most of the time this will be the main program, but libraries my also import and use other libraries.</p>
	  <p>Libraries will first be searched in three locations in order:</p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>The current directory, i.e. the directory from which you have invoked <span class="application">yabasic</span>)</p>
	    </li><li class="listitem">
	      <p>The directory, where your main program lives. This can be different from the first directory, if you specify a path for your main program, e.g. like <code class="literal">yabasic foo/bar.yab</code>.</p>
	    </li><li class="listitem">
	    <p>Finally, libraries are searched within a special directory, whose exact location depends on your system or options when invoking <span class="application">yabasic</span>. Typical values would be <code class="filename">/usr/lib</code> under Unix or <code class="filename">C:\yabasic\lib</code> under Windows. Invoking <strong class="userinput"><code>yabasic --help</code></strong> will show the correct directory. The location of this directory may be changed with the option <code class="literal">--librarypath</code> (see <a class="link" href="#chapter_options" title="Chapter&#160;4.&#160;Command line options of yabasic">options</a>).</p></li></ul></div>
	</div>
	<div class="refsection" id="id6834"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <p>Lets say you have a <span class="application">yabasic</span>-program <code class="computeroutput">foo.yab</code>, which imports a library <code class="computeroutput">lib.yab</code>. <code class="computeroutput">foo.yab</code> would read:</p>
	    <pre class="programlisting">
import lib

rem  This works
lib.x(0)

rem  This works too
x(1)

rem  And this
lib.y(2)

rem  But this not !
y(3)
          </pre>
	    <p>Now the library <code class="computeroutput">lib.yab</code>:</p>
	    <pre class="programlisting">
rem  Make the subroutine x easily available outside this library
export sub x(a)
  print a
  return
end sub

rem  sub y must be referenced by its full name
rem  outside this library
sub y(a)
  print a
  return
end sub
</pre>
	    <p>This program produces an error:</p>
	    <p>
</p><pre class="programlisting">
0
1
2
---Error in foo.yab, line 13: can't find subroutine 'y'
---Dump: sub y() called in foo.yab,13
---Error: Program stopped due to an error
</pre><p>
As you may see from the error message, <span class="application">yabasic</span> is unable to find the subroutine <code class="function">y</code> without specifying the name of the library (i.e. <code class="function">lib.y</code>). The reason for this is, that <code class="function">y</code>, other than <code class="function">x</code>, is <span class="emphasis"><em>not</em></span> exported from the library <code class="filename">lib.yab</code> (using the <code class="function">export</code>-statement).
</p>
	  </div>
	</div>
	<div class="refsection" id="id6859"><h2>See also</h2>
	  
	  <p><a class="link" href="#top_lib" title="Libraries">Libraries</a>, <code class="function"><a class="link" href="#ref_export" title="export">export</a></code>, <code class="function"><a class="link" href="#ref_sub" title="sub">sub</a></code></p>
	</div>
      </div>
      
      <div class="refentry" id="ref_inkey"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  inkey$
	   &#8212; wait, until a key is pressed
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
clear screen
foo$=inkey$
inkey$
foo$=inkey$(bar)
inkey$(bar)
</pre>
	</div>
	<div class="refsection" id="id6877"><h2>Description</h2>
	  
	  <p>The <code class="function">inkeys$</code>-function waits, until the user presses a key on the keyboard or a button of his mouse, and returns this very key. An optional argument specifies the number of seconds to wait; if omitted, <code class="function">inkey$</code> will wait indefinitely.</p>
	  <p><code class="function">inkey$</code> may only be used, if <code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></code> has been called at least once.</p>
	  <p>For normal keys, <span class="application">yabasic</span> simply returns the key, e.g. <code class="computeroutput">a</code>, <code class="computeroutput">1</code> or <code class="computeroutput">!</code>. For function keys you will get <code class="computeroutput">f1</code>, <code class="computeroutput">f2</code> and so on. Other special keys will return these strings respectively: <code class="computeroutput">enter</code>, <code class="computeroutput">backspace</code>, <code class="computeroutput">del</code>, <code class="computeroutput">esc</code>, <code class="computeroutput">scrnup</code> (for <span class="emphasis"><em>screen up</em></span>), <code class="computeroutput">scrndown</code> and <code class="computeroutput">tab</code>. Modifier keys (e.g. <code class="computeroutput">ctrl</code>, <code class="computeroutput">alt</code> or <code class="computeroutput">shift</code>) by themselves can <span class="emphasis"><em>not</em></span> be detected (e.g. if you simultaneously press <code class="computeroutput">shift</code> and '<code class="computeroutput">a</code>', <code class="function">inkey$</code> will return the letter '<code class="computeroutput">A</code>' instead of '<code class="computeroutput">a</code>' of course).</p>
	  <p>If a graphical window has been opened (via <code class="function">open window</code>) any mouseclick within this window will be returned by <code class="function">inkey$</code> too. The string returned (e.g. <code class="computeroutput">MB1d+0:0028,0061</code>, <code class="computeroutput">MB2u+0:0028,0061</code> or <code class="computeroutput">MB1d+1:0028,0061</code>) is constructed as follows: </p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>Every string associated with a mouseclick will start with the fixed string <code class="computeroutput">MB</code></p>
	    </li><li class="listitem">
	      <p>The next digit (<code class="computeroutput">1</code>, <code class="computeroutput">2</code> or <code class="computeroutput">3</code>) specifies the mousebutton pressed.</p>
	    </li><li class="listitem">
	      <p>A single letter, <code class="computeroutput">d</code> or <code class="computeroutput">u</code>, specifies, if the mousebutton has been pressed or released: <code class="computeroutput">d</code> stands for <span class="emphasis"><em>down</em></span>, i.e. the mousebutton has been pressed; <code class="computeroutput">u</code> means <span class="emphasis"><em>up</em></span>, i.e. the mousebutton has been released.</p>
	    </li><li class="listitem">
	      <p>The plus-sign ('<code class="computeroutput">+</code>'), which follows is always fixed.</p>
	    </li><li class="listitem">
	      <p>The next digit (in the range 0 to 7) encodes the modifier keys pressed, where <code class="computeroutput">1</code> stands for <code class="computeroutput">shift</code>, <code class="computeroutput">2</code> stands for <code class="computeroutput">alt</code> and <code class="computeroutput">4</code> stands for <code class="computeroutput">ctrl</code>.</p>
	    </li><li class="listitem">
	      <p>The next four digits (e.g. <code class="computeroutput">0028</code>) contain the x-position, where the mousebutton has been pressed.</p>
	    </li><li class="listitem">
	      <p>The comma to follow is always fixed.</p>
	    </li><li class="listitem">
	      <p>The last four digits (e.g. <code class="computeroutput">0061</code>) contain the y-position, where the mousebutton has been pressed.</p>
	    </li></ul></div>

	  <p>All those fields are of fixed length, so you may use functions like <code class="function">mid$</code> to extract certain fields. However, note that with <code class="function">mousex</code>, <code class="function">mousey</code>, <code class="function">mouseb</code> and <code class="function">mousemod</code> there are specialized functions to return detailed information about the mouseclick. Finally it should be noted, that <code class="function">inkey$</code> will only register mouseclicks within the graphic-window; mouseclicks in the text-window cannot be detected.</p>
	  <p><code class="function">inkey$</code> accepts an optional argument, specifying a timeout in seconds; if no key has been pressed within this span of time, an empty string is returned. If the timeout-argument is omitted, <code class="function">inkey$</code> will wait for ever.</p>
	</div>
	<div class="refsection" id="id6964"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
clear screen
open window 100,100
print "Press any key or press 'q' to stop."
repeat
  a$=inkey$
  print a$
until a$="q"
          </pre>
	    <p>This program simply returns the key pressed. You may use it, to learn, which strings are returned for the special keys on your keyboard (e.g. function-keys).</p>
	  </div>
	</div>
	<div class="refsection" id="id6971"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></code>,<code class="function"><a class="link" href="#ref_mousex" title="mousex">mousex</a></code>, <code class="function"><a class="link" href="#ref_mousey" title="mousey">mousey</a></code>, <code class="function"><a class="link" href="#ref_mouseb" title="mouseb">mouseb</a></code>, <code class="function"><a class="link" href="#ref_mousemod" title="mousemod">mousemod</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_input"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  input
	   &#8212; read input from user or  file and assign it to a variable
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
input a
input a,b,c
input a$
input "Hello" a
input #1 a$
input at(10,10) "Your input: " a$
input color("red") "Are you sure ?" a$
</pre>
	</div>
	<div class="refsection" id="id6994"><h2>Description</h2>
	  
	  <p><code class="function">input</code> reads the new contents of one or many (numeric- or string-) variables, either from the keyboard (i.e. from <span class="emphasis"><em>you</em></span>) or from a file. An optional first string-argument specifies a prompt, which will be issued before reading any contents.</p>
	  <p>If you want to read from an open file, you need to specify a hash ('#'), followed by the number, under which the file has been opened.</p>
	  <p>Note, that the input is split at spaces, i.e. if you enter a whole line consisting of many space-separated word, the first <code class="function">input</code>-statement will return the first word only; the other words will be returned on subsequent calls to <code class="function">input</code>; the same applies, if a single <code class="function">input</code> reads multiple variables: The first variable gets only the first word, the second one the second word, and so on. If you don't like this behaviour, you may use <code class="function">line input</code>, which returns a whole line (including embedded spaces) at once.</p>
	  <p>For more control, <code class="function">input</code> supports the same two clauses <code class="function"><a class="link" href="#ref_at" title="at()">at</a></code> and <a class="link" href="#ref_print_color" title="print or input with color"><code class="function">color</code></a> just as the <a class="link" href="#ref_print" title="print"><code class="function">print</code></a>-statement does.</p>
	</div>
	<div class="refsection" id="id7015"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter the name of a file to read: " a$
open 1,a$
while !eof(1)
  input #1 b$
  print b$
wend
          </pre>
	    <p>If this program is stored within a file <code class="filename">test.yab</code> and you enter this name when prompted for a file to read, you will see this output:</p>
	    <pre class="screen">Please enter the name of a file to read: t.yab
input
"Please
enter
the
name
of
a
file
to
read:
"
a$
open
1,a$
while
!eof(1)
input
#1
b$
print
b$
wend
</pre><p>
</p>
	  </div>
	</div>
	<div class="refsection" id="id7025"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_line_input" title="line input">line input</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_instr"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  instr()
	   &#8212; searches its second argument within the first; returns its position if found
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print instr(a$,b$)
if (instr(a$,b$)) &#8230;
pos=instr(a$,b$,x)
</pre>
	</div>
	<div class="refsection" id="id7040"><h2>Description</h2>
	  
	  <p>The <code class="function">instr</code>-functions requires two string arguments and searches the second argument within the first. If the second argument can be found within the first, the position is returned (counting from one). If it can not be found, the <code class="function">instr</code>-function returns 0; this makes this function usable within the condition of an <code class="function">if</code>-statement (see the example below).</p>
	  <p>If you supply a third, numeric argument to the <code class="function">instr</code>-function, it will be used as a starting point for the search. Therefore <code class="function">instr("abcdeabcdeabcde","e",8)</code> will return 10, because the search for an "<code class="literal">e</code>" starts at position 8 and finds the "<code class="literal">e</code>" at position 10 (and not the one at position 5).</p>

	</div>
	<div class="refsection" id="id7053"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a text containing the string 'cat': " a$
if (instr(a$,"cat")) then
  print "Well done !"
else
  print "No cat in your input ..."
endif
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id7059"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_rinstr" title="rinstr()">rinstr</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_int"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  int()
	   &#8212; return the integer part of its single numeric argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print int(a)
</pre>
	</div>
	<div class="refsection" id="id7074"><h2>Description</h2>
	  
	  <p>The <code class="function">int</code>-function returns only the digits before the comma; <code class="function">int(2.5)</code> returns <code class="computeroutput">2</code> and <code class="function">int(-2.3)</code> returns <code class="computeroutput">-2</code>.</p>
	</div>
	<div class="refsection" id="id7084"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a whole number between 1 and 10: " a
if (a=int(a) and a&gt;=1 and a&lt;=10) then
  print "Thanx !"
else
  print "Never mind ..."
endif
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id7090"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_frac" title="frac()">frac</a></code>, <code class="function"><a class="link" href="#ref_floor" title="floor()">floor</a></code>, <code class="function"><a class="link" href="#ref_ceil" title="ceil()">ceil</a></code>, <code class="function"><a class="link" href="#ref_round" title="round()">round</a></code></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_l"><div class="titlepage"><div><div><h2 class="title" style="clear: both">L</h2></div></div></div>
      

      <div class="refentry" id="ref_label"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  label
	   &#8212; mark a specific location within your program for <code class="function">goto</code>, <code class="function">gosub</code> or <code class="function">restore</code>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
label foo

&#8230;

goto foo
</pre>
	</div>
	<div class="refsection" id="id7118"><h2>Description</h2>
	  
	  <p>The <code class="function">label</code>-command can be used to give a name to a specific location within your program. Such a position might be referred from one of three commands: <code class="function">goto</code>, <code class="function">gosub</code> and <code class="function">restore</code>.</p>
	  <p>You may use labels safely within libraries, because a label (e.g. <code class="computeroutput">foo</code>) does not collide with a label with the same name within the main program or within another library; <span class="application">yabasic</span> will not mix them up.</p>
	  <p>As an aside, please note, that line numbers are a special (however deprecated) case of labels; see the second example below.</p>
	</div>
	<div class="refsection" id="id7131"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=1 to 100
  if (ran(10)&gt;5) goto done
next a
label done

10 for a=1 to 100
20   if (ran(10)&gt;5) goto 40
30 next a
40
          </pre>
	    <p>Within this example, the <code class="function">for</code>-loop will probably be left prematurely with a <code class="function">goto</code>-statement. This task is done <span class="emphasis"><em>twice</em></span>: First with labels and then again with line numbers.</p>
	  </div>
	</div>
	<div class="refsection" id="id7141"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_gosub" title="gosub">gosub</a></code>, <code class="function"><a class="link" href="#ref_goto" title="goto">goto</a></code>.</p>
	</div>
      </div>

      <div class="refentry" id="ref_left"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  left$()
	   &#8212; return (<span class="emphasis"><em>or change</em></span>) left end of a string
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print left$(a$,2)
left$(b$,3)="foobar"
</pre>
	</div>
	<div class="refsection" id="id7159"><h2>Description</h2>
	  
	  <p>The <code class="function">left$</code>-function accepts two arguments (a string and a number) and returns the part from the left end of the string, whose length is specified by its second argument. Loosely spoken, it simply returns the requested number of chars from the left end of the given string.</p>
	  <p>Note, that the <code class="function">left$</code>-function can be assigned to, i.e. it may appear on the left hand side of an assignment. In this way it is possible to change a part of the variable used within the <code class="function">left$</code>-function. Note, that that way the <span class="emphasis"><em>length</em></span> of the string cannot be changed, i.e. characters might be overwritten, but not added. For an example see below.</p>
	</div>
	<div class="refsection" id="id7169"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please answer yes or no: " a$
l=len(a$):a$=lower$(a$):print "Your answer is ";
if (left$("yes",l)=a$ and l&gt;=1) then
  print "yes"
elsif (left$("no",l)=a$ and l&gt;=1) then
  print "no"
else
  print "?"
endif
          </pre>
	    <p>This example asks a simple yes/no question and goes some way to accept even incomplete input, while still being able to reject invalid input.</p>
	    <p>This second example demonstrates the capability to <span class="emphasis"><em>assign</em></span> to the <code class="function">left$</code>-function.</p>
	    <pre class="programlisting">
a$="Heiho World !"
print a$
left$(a$,5)="Hello"
print a$
</pre>
	  </div>
	</div>
	<div class="refsection" id="id7180"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_right" title="right$()">right$</a></code>, <code class="function"><a class="link" href="#ref_mid" title="mid$()">mid$</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_len"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  len()
	   &#8212; return the length of a string
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
x=len(a$)
</pre>
	</div>
	<div class="refsection" id="id7197"><h2>Description</h2>
	  
	  <p>The <code class="function">len</code>-function returns the length of its single string argument.</p>
	</div>
	<div class="refsection" id="id7203"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a password: " a$
if (len(a$)&lt;6) error "Password too short !"
          </pre>
	    <p>This example checks the length of the password, that the user has entered.</p>
	  </div>
	</div>
	<div class="refsection" id="id7210"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_left" title="left$()">left$</a></code>, <code class="function"><a class="link" href="#ref_right" title="right$()">right$</a></code> and <code class="function"><a class="link" href="#ref_mid" title="mid$()">mid$</a></code>, </p>
	</div>
      </div>

      <div class="refentry" id="ref_line"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  line
	   &#8212; draw a line
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
open window 100,100
line 0,0,100,100
line 0,0 to 100,100
new curve
line 100,100
line to 100,100

open window 100,100
clear line 0,0,100,100
clear line 0,0 to 100,100
new curve
clear line 100,100
clear line to 100,100
</pre>
	</div>
	<div class="refsection" id="id7229"><h2>Description</h2>
	  
	  <p>The <code class="function">line</code>-command draws a line. Simple as this is, the <code class="function">line</code>-command has a large variety of forms as they are listed in the synopsis above. Lets look at them a little closer:</p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>A line has a starting and an end point; therefore the <code class="function">line</code>-command (normally) needs four numbers as arguments, representing these two points. This is the first form appearing within the synopsis. </p>
	    </li><li class="listitem">
	      <p>You may separate the two points with either '<code class="computeroutput">,</code>' or <code class="function">to</code>, which accounts for the second form of the <code class="function">line</code>-command.</p>
	    </li><li class="listitem">
	      <p>The <code class="function">line</code>-command may be used to draw a connected sequence of lines with a sequence of commands like <code class="function">line x,y</code>; Each command will draw a line from the point where the last <code class="function">line</code>-command left off, to the point specified in the arguments. Note, that you need to use the command <code class="function">new curve</code> before you may issue such a <code class="function">line</code>-command. See the example below.</p>
	    </li><li class="listitem">
	      <p>You may insert the word <code class="function">to</code> for beauty: <code class="function">line to x,y</code>, which does exactly the same as <code class="function">line x,y</code></p>
	    </li><li class="listitem">
	      <p>Finally, you may choose not to draw, but to erase the lines; this can be done by prepending the phrase <code class="function">clear</code>. This account for all the other forms of the <code class="function">line</code>-command.</p>
	    </li></ul></div>

	</div>
	<div class="refsection" id="id7261"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
line 10,10 to 10,190
line 10,190 to 190,190
new curve
for a=0 to 360
  line to 10+a*180/360,100+60*sin(a*pi/180)
next a
          </pre>
	    <p>This example draws a sine-curve (with an offset in x- and y-direction). Note, that the first <code class="function">line</code>-command after <code class="function">new curve</code> does not draw anything. Only the coordinates will be stored. The second iteration of the loop then uses these coordinates as a starting point for the first line.</p>
	  </div>
	</div>
	<div class="refsection" id="id7270"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_new_curve" title="new curve">new curve</a></code>, <code class="function"><a class="link" href="#ref_close_curve" title="close curve">close curve</a></code>, <code class="function"><a class="link" href="#ref_open_window" title="open window">open window</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_line_input"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  line input
	   &#8212; read in a whole line of text and assign it to a variable
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
line input a
line input a$
line input "Hello" a
line input #1 a$
</pre>
	</div>
	<div class="refsection" id="id7289"><h2>Description</h2>
	  
	  <p>In most respects <code class="function">line input</code> is like the <code class="function"><a class="link" href="#ref_input" title="input">input</a></code>-command: It reads the new contents of a variable, either from keyboard or from a file. However, <code class="function">line input</code> always reads a complete line and assigns it to its variable. <code class="function">line input</code> does not stop reading at spaces and is therefore the best way to read in a string which might contain whitespace. Note, that the final newline is stripped of.</p>
	</div>
	<div class="refsection" id="id7299"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
line input "Please enter your name (e.g. Frodo Beutelin): " a$
print "Hello ",a$
          </pre>
	    <p>Note that the usage of <code class="function">line input</code> is essential in this example; a simple <code class="function">input</code>-statement would only return the string up to the first space, e.g. <code class="computeroutput">Frodo</code>.</p>
	  </div>
	</div>
	<div class="refsection" id="id7309"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_input" title="input">input</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_local"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  local
	   &#8212; mark a variable as local to a subroutine
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
sub foo()

  local a,b,c$,d(10),e$(5,5)

  &#8230;

end sub 
</pre>
	</div>
	<div class="refsection" id="id7324"><h2>Description</h2>
	  
	  <p>The <code class="function">local</code>-command can (and should be) used to mark a variable (or array) as <span class="emphasis"><em>local</em></span> to the containing subroutine. This means, that a local variable in your subroutine is totally different from a variable with the same name within your main program. Variables which are known everywhere within your program are called <span class="emphasis"><em>global</em></span> in contrast.</p>
	  <p>Declaring variables within the subroutine as <span class="emphasis"><em>local</em></span> helps to avoid hard to find bugs; therefore local variables should be used whenever possible.</p>
	  <p>Note, that the parameters of your subroutines are always local.</p>
	  <p>As you may see from the example, local arrays may be created without using the keyword <code class="function">dim</code> (which is required only for global arrays).</p>
	</div>
	<div class="refsection" id="id7337"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
a=1
b=1
print a,b
foo()
print a,b

sub foo()
  local a
  a=2
  b=2
end sub
          </pre>
	    <p>This example demonstrates the difference between <code class="function">local</code> and global variables; it produces this output:</p>
	    <p>
</p><pre class="screen">1 1
1 2
</pre><p>
</p>
	    <p>As you may see, the content of the global variable <code class="varname">a</code> is unchanged after the subroutine <code class="function">foo</code>; this is because the assignment <code class="computeroutput">a=2</code> within the subroutine affects the <span class="emphasis"><em>local</em></span> variable <code class="computeroutput">a</code> only and not the global one. However, the variable <code class="computeroutput">b</code> is never declared local and therefore the subroutine changes the global variable, which is reflected in the output of the second print-statement.</p>
	  </div>
	</div>
	<div class="refsection" id="id7354"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_sub" title="sub">sub</a></code>, <code class="function"><a class="link" href="#ref_static" title="static">static</a></code>, <code class="function"><a class="link" href="#ref_dim" title="dim">dim</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_log"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  log()
	   &#8212; compute the natural logarithm
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
a=log(x)
a=log(x,base)
</pre>
	</div>
	<div class="refsection" id="id7373"><h2>Description</h2>
	  
	  <p>The <code class="function">log</code>-function computes the logarithm of its first argument. The optional second argument gives the base for the logarithm; if this second argument is omitted, the <span class="emphasis"><em>euler</em></span>-constant 2.71828&#8230; will be taken as the base.</p>
	</div>
	<div class="refsection" id="id7380"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
for x=10 to 190 step 10:for y=10 to 190 step 10
  r=3*log(1+x,1+y)
  if (r&gt;10) r=10
  if (r&lt;1) r=1
  fill circle x,y,r
next y:next x
          </pre>
	    <p>This draws another nice plot.</p>
	  </div>
	</div>
	<div class="refsection" id="id7387"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_exp" title="exp()">exp</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_loop"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  loop
	   &#8212; marks the end of an infinite loop
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
do
  &#8230;
loop
</pre>
	</div>
	<div class="refsection" id="id7402"><h2>Description</h2>
	  
	  <p>The <code class="function">loop</code>-command marks the ends of a loop (which is started by <code class="function">do</code>), wherein all statements within the loop are repeated forever. In this respect the <code class="function">do loop</code>-loop is infinite, however, you may leave it anytime via <code class="function">break</code> or <code class="function">goto</code>.</p>
	</div>
	<div class="refsection" id="id7412"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "Hello, I will throw dice, until I get a 2 ..."
do
  r=int(ran(6))+1
  print r
  if (r=2) break
loop
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id7418"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_do" title="do">do</a></code>, <code class="function"><a class="link" href="#ref_for" title="for">for</a></code>, <code class="function"><a class="link" href="#ref_repeat" title="repeat">repeat</a></code>, <code class="function"><a class="link" href="#ref_while" title="while">while</a></code>, <code class="function"><a class="link" href="#ref_break" title="break">break</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_lower"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  lower$()
	   &#8212; convert a string to lower case
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
l$=lower$(a$)
</pre>
	</div>
	<div class="refsection" id="id7441"><h2>Description</h2>
	  
	  <p>The <code class="function">lower$</code>-function accepts a single string-argument and converts it to all lower case.</p>
	</div>
	<div class="refsection" id="id7447"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a password: " a$
if (a$=lower$(a$)) error "Your password is NOT mixed case !"
          </pre>
	    <p>This example prompts for a password and checks, if it is really lower case.</p>
	  </div>
	</div>
	<div class="refsection" id="id7454"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_upper" title="upper$()">upper$</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_ltrim"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  ltrim$()
	   &#8212; trim spaces at the left end of a string
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
a$=ltrim$(b$)
</pre>
	</div>
	<div class="refsection" id="id7469"><h2>Description</h2>
	  
	  <p>The <code class="function">ltrim$</code>-function removes all whitespace from the left end of a string and returns the result.</p>
	</div>
	<div class="refsection" id="id7475"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please answer 'yes' or 'no' : " a$
a$=lower$(ltrim$(rtrim$(a$)))
if (len(a$)&gt;0 and a$=left$("yes",len(a$))) then
  print "Yes ..."
else
  print "No ..."
endif
          </pre>
	    <p>This example prompts for an answer and removes any spaces, which might precede the input; therefore it is even prepared for the (albeit somewhat pathological case, that the user first hits <span class="emphasis"><em>space</em></span> before entering his answer.</p>
	  </div>
	</div>
	<div class="refsection" id="id7483"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_rtrim" title="rtrim$()">rtrim$</a></code>, <code class="function"><a class="link" href="#ref_trim" title="trim$()">trim$</a></code></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_m"><div class="titlepage"><div><div><h2 class="title" style="clear: both">M</h2></div></div></div>
      

      <div class="refentry" id="ref_max"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  max()
	   &#8212; return the larger of its two arguments
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print max(a,b)
</pre>
	</div>
	<div class="refsection" id="id7504"><h2>Description</h2>
	  
	  <p>Return the <span class="emphasis"><em>maximum</em></span> of its two arguments.</p>
	</div>
	<div class="refsection" id="id7510"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
dim m(10)
for a=1 to 1000
  m=0
  For b=1 to 10
    m=max(m,ran(10))
  next b
  m(m)=m(m)+1
next a

for a=1 to 9
  print a,": ",m(a)
next a
          </pre>
	    <p>Within the inner <code class="function">for</code>-loop (the one with the loop-variable <code class="varname">b</code>), the example computes the maximum of 10 random numbers. The outer loop (with the loop variable <code class="varname">a</code>) now repeats this process 1000 times and counts, how often each maximum appears. The last loop finally reports the result.</p>
	    <p>Now, the interesting question would be, which will be approached, when we increase the number of iterations from thousand to infinity. Well, maybe someone could just tell me <code class="computeroutput">:-)</code></p>

	  </div>
	</div>
	<div class="refsection" id="id7522"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_min" title="min()">min</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_mid"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  mid$()
	   &#8212; return (<span class="emphasis"><em>or change</em></span>) characters from within a string
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print mid$(a$,2,1)
print mid$(a$,2)
mid$(a$,5,3)="foo"
mid$(a$,5)="foo"
</pre>
	</div>
	<div class="refsection" id="id7538"><h2>Description</h2>
	  
	  <p>The <code class="function">mid$</code>-function requires three arguments: a string and two numbers, where the first number specifies a position within the string and the second one gives the number of characters to be returned; if you omit the third argument, the <code class="function">mid$</code>-function returns all characters up to the end of the string.</p>
	  <p>Note, that you may assign to the <code class="function">mid$</code>-function, i.e. <code class="function">mid$</code> may appear on the left hand side of an assignment. In this way it is possible to change a part of the variable used within the <code class="function">mid$</code>-function. Note, that that way the <span class="emphasis"><em>length</em></span> of the string cannot be changed, i.e. characters might be overwritten, but not added. For an example see below.</p>
	</div>
	<div class="refsection" id="id7550"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a string: " a$
for a=1 to len(a$)
  if (instr("aeiou",lower$(mid$(a$,a,1)))) mid$(a$,a,1)="e"
next a
print "When you turn everything to lower case and"
print "replace every vowel with 'e', your input reads:"
print
print a$
          </pre>
	    <p>This example transforms the input string a bit, using the <code class="function">mid$</code>-function to retrieve a character from within the string as well as to change it.</p>
	  </div>
	</div>
	<div class="refsection" id="id7558"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_left" title="left$()">left$</a></code> and <code class="function"><a class="link" href="#ref_right" title="right$()">right$</a></code>.</p>
	</div>
      </div>

      <div class="refentry" id="ref_min"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  min()
	   &#8212; return the smaller of its two arguments
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print min(a,b)
</pre>
	</div>
	<div class="refsection" id="id7575"><h2>Description</h2>
	  
	  <p>Return the <span class="emphasis"><em>minimum</em></span> of its two argument.</p>
	</div>
	<div class="refsection" id="id7581"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
dim m(10)
for a=1 to 1000
  m=min(ran(10),ran(10))
  m(m)=m(m)+1
next a

for a=1 to 9
  print a,": ",m(a)
next a
          </pre>
	    <p>For each iteration of the loop, the lower of two random number is recorded. The result is printed at the end.</p>
	  </div>
	</div>
	<div class="refsection" id="id7588"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_max" title="max()">max</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_mod"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  mod
	   &#8212; compute the remainder of a division
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print mod(a,b)
</pre>
	</div>
	<div class="refsection" id="id7603"><h2>Description</h2>
	  
	  <p>The <code class="function">mod</code>-function divides its two arguments and computes the remainder. Note, that <code class="literal">a/b-int(a/b)</code> and <code class="literal">mod(a,b)</code> are always equal.</p>
	</div>
	<div class="refsection" id="id7611"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
clear screen
print at(10,10) "Please wait ";
p$="-\|/"
for a=1 to 100
  rem  ... do something lengthy here, or simply sleep :-)
  pause(1)
  print at(22,10) mid$(p$,1+mod(a,4))
next a
          </pre>
	    <p>This example executes some time consuming action within a loop (in fact, it simply sleeps) and gives the user some indication of progress by displaying a rotating bar (that's where the <code class="function">mod</code>-function comes into play).</p>
	  </div>
	</div>
	<div class="refsection" id="id7619"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_int" title="int()">int</a></code>, <code class="function"><a class="link" href="#ref_frac" title="frac()">frac</a></code>, <code class="function"><a class="link" href="#ref_round" title="round()">round</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_mouseb"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  mouseb
	   &#8212; extract the state of the mousebuttons from a string returned by <code class="function">inkey$</code>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
inkey$
print mouseb()
print mouseb
a$=inkey$
print mouseb(a$)
</pre>
	</div>
	<div class="refsection" id="id7639"><h2>Description</h2>
	  
	  <p>The <code class="function">mouseb</code>-function is a helper function for decoding part of the (rather complicated) strings, which are returned by the <code class="function">inkey$</code>-function. If a mousebutton has been pressed, the <code class="function">mouseb</code>-function returns the number (1,2 or 3) of the mousebutton, when it is pressed and returns its negative (-1,-2 or -3), when it is released.</p>
	  <p>The <code class="function">mouseb</code>-function accepts zero or one arguments. A single argument should be a string returned by the <code class="function">inkey$</code>-function; if <code class="function">mouseb</code> is called without any arguments, it returns the values from the last call to <code class="function">inkey$</code>, which are stored implicitly and internally by <span class="application">yabasic</span>.</p>
	  <div class="note"><h3 class="title">Note</h3>
	    <p>Note however, that the value returned by the <code class="function">mouseb</code>-function does <span class="emphasis"><em>not</em></span> reflect the <span class="emphasis"><em>current</em></span> state of the mousebuttons. It rather extracts the information from the string passed as an argument (or from the last call to the <code class="function">inkey$</code>-function, if no argument is passed). So the value returned by <code class="function">mouseb</code> reflects the state of the mousebuttons at the time the <code class="function">inkey$</code>-function has been called; as opposed to the time the <code class="function">mouseb</code>-function is called.</p>
	  </div>
	</div>
	<div class="refsection" id="id7662"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
clear screen
print "Please draw lines; press (and keep it pressed)" 
print "the left mousebutton for the starting point,"
print "release it for the end-point."
do
  if (mouseb(release$)=1) press$=release$
  release$=inkey$
  if (mouseb(release$)=-1) then
    line mousex(press$),mousey(press$) to mousex(release$),mousey(release$)
  endif
loop
          </pre>
	    <p>This is a maybe the most simplistic line-drawing program possible, catching presses as well as releases of the first mousebutton.</p>
	  </div>
	</div>
	<div class="refsection" id="id7669"><h2>See also</h2>
	  	  
	  <p><code class="function"><a class="link" href="#ref_inkey" title="inkey$">inkey$</a></code>, <code class="function"><a class="link" href="#ref_mousex" title="mousex">mousex</a></code>, <code class="function"><a class="link" href="#ref_mousey" title="mousey">mousey</a></code> and <code class="function"><a class="link" href="#ref_mousemod" title="mousemod">mousemod</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_mousemod"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  mousemod
	   &#8212; return the state of the modifier keys during a mouseclick
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
inkey$
print mousemod()
print mousemod
a$=inkey$
print mousemod(a$)
</pre>
	</div>
	<div class="refsection" id="id7690"><h2>Description</h2>
	  
	  <p>The <code class="function">mousemod</code>-function is a helper function for decoding part of the (rather complicated) strings, which are returned by the <code class="function">inkey$</code>-function if a mousebutton has been pressed. It returns the state of the keyboard modifiers (<code class="literal">shift</code>, <code class="literal">ctrl</code> or <code class="literal">alt</code>): If the <code class="literal">shift</code>-key is pressed, <code class="function">mousemod</code> returns 1, for the <code class="literal">alt</code>-key 2 and for the <code class="literal">ctrl</code>-key 4. If more than one key is pressed, the sum of these values is returned, e.g. <code class="function">mousemod</code> returns 5, if <code class="literal">shift</code> and <code class="literal">ctrl</code> are pressed simultaneously.</p>
	  <p>The <code class="function">mousemod</code>-function accepts zero or one arguments. A single argument should be a string returned by the <code class="function">inkey$</code>-function; if <code class="function">mousemod</code> is called without any arguments, it returns the values from the last call to <code class="function">inkey$</code> (which are stored implicitly and internally by yabasic).</p>
	  <div class="note"><h3 class="title">Note</h3>
	    <p>Please see also the Note within the <code class="function"><a class="link" href="#ref_mouseb" title="mouseb">mouseb</a></code>-function.</p>
	  </div>
	</div>
	<div class="refsection" id="id7716"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
clear screen
do
  a$=inkey$
  if (left$(a$,2)="MB") then
    x=mousex(a$)
    y=mousey(a$)
    if (mousemod(a$)=0) then
      circle x,y,20
    else
      fill circle x,y,20
    endif
  endif
loop
          </pre>
	    <p>This program draws a circle, whenever a mousebutton is pressed; the circles are filled, when any modifier is pressed, and empty if not.</p>
	  </div>
	</div>
	<div class="refsection" id="id7723"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_inkey" title="inkey$">inkey$</a></code>, <code class="function"><a class="link" href="#ref_mousex" title="mousex">mousex</a></code>, <code class="function"><a class="link" href="#ref_mousey" title="mousey">mousey</a></code> and <code class="function"><a class="link" href="#ref_mouseb" title="mouseb">mouseb</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_mousex"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  mousex
	   &#8212; return the x-position of a mouseclick
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
inkey$
print mousex()
print mousex
a$=inkey$
print mousex(a$)
</pre>
	</div>
	<div class="refsection" id="id7744"><h2>Description</h2>
	  
	  <p>The <code class="function">mousex</code>-function is a helper function for decoding part of the (rather complicated) strings, which are returned by the <code class="function">inkey$</code>-function; It returns the x-position of the mouse as encoded within its argument.</p>
	  <p>The <code class="function">mousex</code>-function accepts zero or one arguments. A single argument should be a string returned by the <code class="function">inkey$</code>-function; if <code class="function">mousex</code> is called without any arguments, it returns the values from the last call to <code class="function">inkey$</code> (which are stored implicitly and internally by yabasic).</p>
	  <div class="note"><h3 class="title">Note</h3>
	    <p>Please see also the Note within the <code class="function"><a class="link" href="#ref_mouseb" title="mouseb">mouseb</a></code>-function.</p>
	  </div>
	</div>
	<div class="refsection" id="id7760"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
clear screen
do
  a$=inkey$
  if (left$(a$,2)="MB") then
    line mousex,0 to mousex,200
  endif
loop
          </pre>
	    <p>This example draws vertical lines at the position, where the mousebutton has been pressed.</p>
	  </div>
	</div>
	<div class="refsection" id="id7767"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_inkey" title="inkey$">inkey$</a></code>, <code class="function"><a class="link" href="#ref_mousemod" title="mousemod">mousemod</a></code>, <code class="function"><a class="link" href="#ref_mousey" title="mousey">mousey</a></code> and <code class="function"><a class="link" href="#ref_mouseb" title="mouseb">mouseb</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_mousey"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  mousey
	   &#8212; return the y-position of a mouseclick
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
inkey$
print mousey()
print mousey
a$=inkey$
print mousey(a$)
</pre>
	</div>
	<div class="refsection" id="id7788"><h2>Description</h2>
	  
	  <p>The <code class="function">mousey</code>-function is a helper function for decoding part of the (rather complicated) strings, which are returned by the <code class="function">inkey$</code>-function. <code class="function">mousey</code> returns the y-position of the mouse as encoded within its argument.</p>
	  <p>The <code class="function">mousey</code>-function accepts zero or one arguments. A single argument should be a string returned by the <code class="function">inkey$</code>-function; if <code class="function">mousey</code> is called without any arguments, it returns the values from the last call to <code class="function">inkey$</code> (which are stored implicitly and internally by yabasic).</p>
	  <div class="note"><h3 class="title">Note</h3>
	    <p>Please see also the Note within the <code class="function"><a class="link" href="#ref_mouseb" title="mouseb">mouseb</a></code>-function.</p>
	  </div>
	</div>
	<div class="refsection" id="id7805"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
clear screen
do
  a$=inkey$
  if (left$(a$,2)="MB") then
    line 0,mousey to 200,mousey
  endif
loop
          </pre>
	    <p>This example draws horizontal lines at the position, where the mousebutton has been pressed.</p>
	  </div>
	</div>
	<div class="refsection" id="id7812"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_inkey" title="inkey$">inkey$</a></code>, <code class="function"><a class="link" href="#ref_mousemod" title="mousemod">mousemod</a></code>, <code class="function"><a class="link" href="#ref_mousey" title="mousey">mousex</a></code> and <code class="function"><a class="link" href="#ref_mouseb" title="mouseb">mouseb</a></code></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_n"><div class="titlepage"><div><div><h2 class="title" style="clear: both">N</h2></div></div></div>
      

      <div class="refentry" id="ref_new_curve"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  new curve
	   &#8212; start a new curve, that will be drawn with the <code class="function">line</code>-command
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
new curve
line to x,y
</pre>
	</div>
	<div class="refsection" id="id7838"><h2>Description</h2>
	  
	  <p>The <code class="function">new curve</code>-function starts a new sequence of lines, that will be drawn by repeated <code class="function">line to</code>-commands.</p>
	</div>
	<div class="refsection" id="id7845"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
ellipse(100,50,30,60)
ellipse(150,100,60,30)
sub ellipse(x,y,xr,yr)
  new curve
  for a=0 to 2*pi step 0.2
    line to x+xr*cos(a),y+yr*sin(a)
  next a
  close curve
end sub
  
          </pre>
	    <p>This example defines a subroutine <code class="function">ellipse</code> that draws an ellipse. Within this subroutine, the ellipse is drawn as a sequence of lines started with the <code class="function">new curve</code> command and closed with <code class="function">close curve</code>.</p>
	  </div>
	</div>
	<div class="refsection" id="id7855"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_line" title="line">line</a></code>, <code class="function"><a class="link" href="#ref_close_curve" title="close curve">close curve</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_next"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  next
	   &#8212; mark the end of a for loop
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
for a=1 to 10
next a
</pre>
	</div>
	<div class="refsection" id="id7872"><h2>Description</h2>
	  
	  <p>The <code class="function">next</code>-keyword marks the end of a <code class="function">for</code>-loop. All statements up to the <code class="function">next</code>-keyword will be repeated as specified with the <code class="function">for</code>-clause. Note, that the name of the variable is optional; so instead of <code class="literal">next a</code> you may write <code class="literal">next</code>.</p>
	</div>
	<div class="refsection" id="id7883"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=1 to 300000
  for b=1 to 21+20*sin(pi*a/20)
    print "*";
  next b
  print
  sleep 0.1
next a
          </pre>
	    <p>This example simply plots a sine-curve until you fall asleep.</p>
	  </div>
	</div>
	<div class="refsection" id="id7890"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_for" title="for">for</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_logical_not"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  not
	   &#8212; negate a logical expression; can be written as <code class="function">!</code>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
if not a&lt;b then &#8230;
bad=!okay
</pre>
	</div>
	<div class="refsection" id="id7906"><h2>Description</h2>
	  
	  <p>The keyword <code class="function">not</code> (or <code class="function">!</code> for short) is mostly used within conditions (e.g. within <code class="function">if</code>- or <code class="function">while</code>-statements). There it is employed to negate the condition or expression (i.e. turn <code class="literal">TRUE</code> into <code class="literal">FALSE</code> and vice versa)</p>
	  <p>However <code class="function">not</code> can be used within arithmetic calculations too., simply because there is no difference between arithmetic and logical expressions.</p>
	</div>
	<div class="refsection" id="id7919"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter three ascending numbers: " a,b,c
if (not (a&lt;b and b&lt;c)) error " the numbers you have entered are not ascending ..."
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id7925"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_logical_and" title="and"><code class="function">and</code></a>,<a class="link" href="#ref_logical_or" title="logical or"><code class="function">or</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_numparams"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  numparams
	   &#8212; return the number of parameters, that have been passed to a subroutine
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
sub foo(a,b,c)
  if (numparams=1) &#8230;
  &#8230;
end sub
</pre>
	</div>
	<div class="refsection" id="id7942"><h2>Description</h2>
	  
	  <p>Within a subroutine the local variable <code class="varname">numparam</code> or <code class="varname">numparams</code> contains the number of parameters, that have been passed to the subroutine. This information can be useful, because the subroutine may have been called with fewer parameters than actually declared. The number of values that actually have been passed while calling the subroutine, can be found in <code class="varname">numparams</code>.</p>
	  <p>Note, that arguments which are used in the definition of a subroutine but are left out during a call to it (thereby reducing the value of <code class="varname">numparams</code>), receive a value of <code class="literal">0</code> or <code class="literal">""</code> (empty string) respectively.</p>
	</div>
	<div class="refsection" id="id7954"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
a$="123456789"
print part$(a$,4)
print part$(a$,3,7)

sub part$(a$,f,t)
  if (numparams=2) then
    return mid$(a$,f)
  else 
    return mid$(a$,f,t-f+1)
  end if
end sub
          </pre>
	    <p>When you run this example, it will print <code class="computeroutput">456789</code> and <code class="computeroutput">34567</code>. Take a look at the subroutine <code class="function">part$</code>, which returns part of the string which has been passed as an argument. If (besides the string) two numbers are passed, they define the starting and end position of the substring, that will be returned. However, if only one number is passed, the rest of the string, starting from this position will be returned. Each of these cases is recognized with the help of the <code class="varname">numparams</code>-variable.</p>
	  </div>
	</div>
	<div class="refsection" id="id7965"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_sub" title="sub">sub</a></code></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_o"><div class="titlepage"><div><div><h2 class="title" style="clear: both">O</h2></div></div></div>
      

      <div class="refentry" id="ref_on_gosub"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  on goto
	   &#8212; jump to one of multiple <code class="function">gosub</code>-targets
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
on a gosub foo,bar,baz
  &#8230;
label foo
  &#8230;
return

label bar
  &#8230;
return

label baz
  &#8230;
return
</pre>
	</div>
	<div class="refsection" id="id7985"><h2>Description</h2>
	  
	  <p>The <code class="function">on gosub</code> statement uses its numeric argument (the one between <code class="function">on</code> and <code class="function">gosub</code>) to select an element from the list of labels, which follows after the <code class="function">gosub</code>-keyword: If the number is 1, the program does a <code class="function">gosub</code> to the first label; if the number is 2, to the second and, so on. if the number is zero or less, the program continues at the position of the first label; if the number is larger than the total count of labels, the execution continues at the position of the last label; i.e. the first and last label in the list constitute some kind of fallback-slot.</p>
	  <p>Note, that the <code class="function">on gosub</code>-command can no longer be considered <span class="emphasis"><em>state of the art</em></span>; people (not me !) may even start to mock you, if you use it.</p>
	</div>
	<div class="refsection" id="id7998"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
do
  print "Please enter a number between 1 and 3: "
  print
  input "Your choice " a
  on a gosub bad,one,two,three,bad
loop

label bad
  print "No. Please between 1 and 3"
return

label one
  print "one"
return

label two
  print "two"
return

label three
  print "three"
return
          </pre>
	    <p>Note, how invalid input (a number less than 1, or larger than 3) is automatically detected.</p>
	  </div>
	</div>
	<div class="refsection" id="id8005"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_goto" title="goto">goto</a></code>, <code class="function"><a class="link" href="#ref_on_gosub" title="on gosub">on gosub/function&gt;</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_on_goto"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  on goto
	   &#8212; jump to one of many <code class="function">goto</code>-targets
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
on a goto foo,bar,baz
  &#8230;
label foo
  &#8230;
label bar
  &#8230;
label baz
  &#8230;
</pre>
	</div>
	<div class="refsection" id="id8023"><h2>Description</h2>
	  
	  <p>The <code class="function">on goto</code> statement uses its numeric argument (the one between <code class="function">on</code> and <code class="function">goto</code> to select an element from the list of labels, which follows after the <code class="function">goto</code>-keyword: If the number is 1, the execution continues at the first label; if the number is 2, at the second, and so on. if the number is zero or less, the program continues at the position of the first label; if the number is larger than the total count of labels, the execution continues at the position of the last label; i.e. the first and last label in the list constitute some kind of fallback-slot.</p>
	  <p>Note, that (unlike the <code class="function">goto</code>-command) the <code class="function">on goto</code>-command can no longer be considered <span class="emphasis"><em>state of the art</em></span>; people may (not me !) even start to mock you, if you use it.</p>
	</div>
	<div class="refsection" id="id8036"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
label over
print "Please Select one of these choices: "
print
print "  1 -- show time"
print "  2 -- show date"
print "  3 -- exit"
print
input "Your choice " a
on a goto over,show_time,show_date,terminate,over

label show_time
  print time$()
goto over

label show_date
  print date$()
goto over

label terminate
exit
          </pre>
	    <p>Note, how invalid input (a number less than 1, or larger than 3) is automatically detected; in such a case the question is simply issued again.</p>
	  </div>
	</div>
	<div class="refsection" id="id8043"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_goto" title="goto">goto</a></code>, <code class="function"><a class="link" href="#ref_on_gosub" title="on gosub">on gosub/function&gt;</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_on_interrupt"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  on interrupt
	   &#8212; change reaction on keyboard interrupts
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
on interrupt break
&#8230;
on interrupt continue
</pre>
	</div>
	<div class="refsection" id="id8060"><h2>Description</h2>
	  
	  <p>With the <code class="function">on interrupt</code>-command you may change the way, how yabasic reacts on a keyboard interrupt; it comes in two variants: <code class="function">on interrupt break</code> and <code class="function">on interrupt continue</code>. A keyboard interrupt is produced, if you press <strong class="userinput"><code>ctrl-C</code></strong> on your keyboard; normally (and certainly after you have called <code class="function">on interrupt break</code>), <span class="application">yabasic</span> will terminate with an error message. However after the command <code class="function">on interrupt continue</code> yabasic ignores any keyboard interrupt. This may be useful, if you do not want your program being interruptible during certain critical operations (e.g. updating of files).</p>
	</div>
	<div class="refsection" id="id8072"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "Please stand by while writing a file with random data ..."
on interrupt continue
open "random.data" for writing as #1
for a=1 to 100
  print #1 ran(100)
  print a," percent done."
  sleep 1
next a
close #1
on interrupt continue
          </pre>
	    <p>This program writes a file with 100 random numbers. The <code class="function">on interrupt continue</code> command insures, that the program will not be terminated on a keyboard interrupt and the file will be written entirely in any case. The <code class="function">sleep</code>-command just stretches the process artificially to give you a chance to try a <strong class="userinput"><code>ctrl-C</code></strong>.</p>
	  </div>
	</div>
	<div class="refsection" id="id8082"><h2>See also</h2>
	  
	  <p>There is no related command.</p>
	</div>
      </div>

      <div class="refentry" id="ref_open"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  open
	   &#8212; open a file
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
open a,"file","r"
open #a,"file","w"
open #a,printer
open "file" for reading as a
open "file" for writing as #a
a=open("file")
a=open("file","r")
if (open(a,"file")) &#8230;
if (open(a,"file","w")) &#8230;
</pre>
	</div>
	<div class="refsection" id="id8095"><h2>Description</h2>
	  
	  <p>The <code class="function">open</code>-command opens a file for reading or writing or a printer for printing text. <code class="function">open</code> comes in a wide variety of ways; it requires these arguments:</p>
	  <div class="variablelist"><dl class="variablelist"><dt><span class="term">filenumber</span></dt><dd>
		<p>In the synopsis this is <code class="literal">a</code> or <code class="literal">#a</code>. In <span class="application">yabasic</span> each file is associated with a number between 1 and a maximum value, which depends on the operating system. For historical reasons the filenumber can be preceded by a hash ('<code class="literal">#</code>'). Note, that specifying a filenumber is optional; if it is omitted, the <code class="function">open</code>-function will return a filenumber, which should then be stored in a variable for later reference. This filenumber can be a simple number or an arbitrary complex arithmetic expression, in which case braces might be necessary to save <span class="application">yabasic</span> from getting confused.</p>
	      </dd><dt><span class="term">filename</span></dt><dd>
		<p>In the synopsis above this is <code class="literal">"file"</code>. This string specifies the name of the file to open (note the important <a class="link" href="#ref_windows_filenames" title="Specifying Filenames under Windows">caveat</a> on specifying these filenames; in short: avoid using '<code class="literal">\</code>', rather use '<code class="literal">/</code>').</p>
	      </dd><dt><span class="term">accessmode</span></dt><dd>
		<p>In the synopsis this is <code class="literal">"r"</code>, <code class="literal">"w"</code>, <code class="literal">for reading</code> or <code class="literal">for writing</code>. This string or clause specifies the mode in which the file is opened; it may be one of:
		</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">"r"</span></dt><dd>
			<p>Open the file for reading (may also be written as <code class="literal">for reading</code>). If the file does not exist, the command will fail. This mode is the default, i.e. if no mode is specified with the <code class="function">open</code>-command, the file will be opened with this mode.</p>
		      </dd><dt><span class="term">"w"</span></dt><dd>
			<p>Open the file for writing (may also be written as <code class="literal">for writing</code>). If the file does not exist, it will be created.</p>
		      </dd><dt><span class="term">"a"</span></dt><dd>
			<p>Open the file for appending, i.e. what you write to the file will be appended after its initial contents. If the file does not exist, it will be created.</p>
		      </dd><dt><span class="term">"b"</span></dt><dd>
			<p>This letter may not appear alone, but may be combined with the other letters (e.g. <code class="literal">"rb"</code>) to open a file in binary mode (as opposed to text mode).</p>
		      </dd></dl></div><p>

	      </p></dd></dl></div>
	  <p>As you may see from the synopsis, the <code class="function">open</code>-command may either be called as a command (without braces) or as a function (with braces). If called as a function, it will return the filenumber or zero if the operation fails. Therefore the <code class="function">open</code>-function may be used within the condition of an <code class="function">if</code>-statement.</p>
	  <p>If the <code class="function">open</code>-command fails, you may use <code class="function"><a class="link" href="#ref_peek" title="peek">peek("error")</a></code> to retrieve the exact nature of the error.</p>
	  <p>Furthermore note, that there is another, somewhat separate usage of the <code class="function">open</code>-command; if you specify the bareword <code class="literal">printer</code> instead of a filename, the command opens a printer for printing text. Every text (and only text) you print to this file will appear on your printer. Note, that this is very different from printing graphics, as can be done with <code class="function"><a class="link" href="#ref_open_printer" title="open printer">open printer</a></code>.</p>
	</div>
	<div class="refsection" id="id8163"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open "foo.bar" for writing as #1
print #1 "Hallo !"
close #1
if (not open(1,"foo.bar")) error "Could not open 'foo.bar' for reading"
while not eof(1)
  line input #1 a$
  print a$
wend
          </pre>
	    <p>This example simply opens the file <code class="literal">foo.bar</code>, writes a single line, reopens it and reads its contents again.</p>
	  </div>
	</div>
	<div class="refsection" id="id8171"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_close" title="close">close</a></code>, <code class="function"><a class="link" href="#ref_print" title="print">print</a></code>, <code class="function"><a class="link" href="#ref_peek" title="peek">peek</a></code>, <code class="function"><a class="link" href="#ref_peek" title="peek">peek("error")</a></code> and <code class="function"><a class="link" href="#ref_open_printer" title="open printer">open printer</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_open_printer"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  open printer
	   &#8212; open printer for printing graphics
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
open printer
open printer "file"
</pre>
	</div>
	<div class="refsection" id="id8194"><h2>Description</h2>
	  
	  <p>The <code class="function">open printer</code>-command opens a printer for printing graphics. The command requires, that a graphic window has been opened before. Everything that is drawn into this window will then be sent to the printer too.</p>
	  <p>A new piece of paper may be started with the <code class="function">clear window</code>-command; the final (or only) page will appear after the <code class="function">close printer</code>-command.</p>
	  <p>Note, that you may specify a filename with <code class="function">open printer</code>; in that case the printout will be sent to a filename instead to a printer. Your program or the user will be responsible for sending this file to the printer afterwards.</p>
	  <p>If you use <span class="application">yabasic</span> under Unix, you will need a postscript printer (because <span class="application">yabasic</span> produces postscript output). Alternatively you may use <span class="emphasis"><em>ghostscript</em></span> to transform the postscript file into a form suitable for your printer; but that is beyond the responsibility of <span class="application">yabasic</span>.</p>
	</div>
	<div class="refsection" id="id8210"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
open printer
line 0,0 to 200,200
text 100,100,"Hallo"
close window
close printer
          </pre>
	    <p>This example will open a window, draw a line and print some text within; everything will appear on your printer too.</p>
	  </div>
	</div>
	<div class="refsection" id="id8217"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_close_printer" title="close printer">close printer</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_open_window"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  open window
	   &#8212; open a graphic window
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
open window x,y
open window x,y,"font"
</pre>
	</div>
	<div class="refsection" id="id8232"><h2>Description</h2>
	  
	  <p>The <code class="function">open window</code>-command opens a window of the specified size. Only one window can be opened at any given moment of time.</p>
	  <p>An optional third argument specifies a font to be used for any text within the window. It can however be changed with any subsequent <code class="function"><a class="link" href="#ref_text" title="text">text</a></code>-command. </p>
	</div>
	<div class="refsection" id="id8241"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=200 to 400 step 10
  open window a,a
  for b=0 to a
    line 0,b to a,b
    line b,0 to b,a
  sleep 0.1
  close window
next a
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id8247"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_close_window" title="close window">close window</a></code>, <code class="function"><a class="link" href="#ref_text" title="text">text</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_logical_or"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  or
	   &#8212; logical or, used in conditions
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
if a or b &#8230;
while a or b &#8230;
</pre>
	</div>
	<div class="refsection" id="id8264"><h2>Description</h2>
	  
	  <p>Used in conditions (e.g within <code class="function"><a class="link" href="#ref_if" title="if">if</a></code> or <code class="function"><a class="link" href="#ref_while" title="while">while</a></code>) to join two expressions. Returns <code class="constant">true</code>, if either its left or its right or both arguments are <code class="constant">true</code>; returns <code class="constant">false</code> otherwise.</p>
	</div>
	<div class="refsection" id="id8276"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a number"
if (a&gt;9 or a&lt;1) print "a is not between 1 and 9"
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id8282"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_logical_and" title="and"><code class="function">and</code></a>,<a class="link" href="#ref_logical_not" title="not"><code class="function">bitnot</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_bitwise_or"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  or()
	   &#8212; arithmetic or, used for bit-operations
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
x=or(a,b)
</pre>
	</div>
	<div class="refsection" id="id8299"><h2>Description</h2>
	  
	  <p>Used to compute the bitwise <code class="function">or</code> of both its argument. Both arguments are treated as binary numbers (i.e. a sequence of digits 0 and 1); a bit of the resulting value will then be 1, if any of its arguments has 1 at this position in their binary representation.</p>
	  <p>Note, that both arguments are silently converted to integer values and that negative numbers have their own binary representation and may lead to unexpected results when passed to <code class="function">or</code>.</p>
	</div>
	<div class="refsection" id="id8307"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print or(14,3)
          </pre>
	    <p>This will print <code class="computeroutput">15</code>. This result is clear, if you note, that the binary representation of 14 and 3 are 1110 and 0011 respectively; this will yield 1111 in binary representation or 15 as decimal.</p>
	  </div>
	</div>
	<div class="refsection" id="id8315"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_bitwise_and" title="and()"><code class="function">and</code></a>, <a class="link" href="#ref_eor" title="eor()"><code class="function">eor</code></a> and <a class="link" href="#ref_bitnot" title="bitnot()"><code class="function">bitnot</code></a></p>
	</div>
      </div>
    </section>

    <section class="section" id="ref_p"><div class="titlepage"><div><div><h2 class="title" style="clear: both">P</h2></div></div></div>
      

      <div class="refentry" id="ref_pause"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  pause
	   &#8212; pause, sleep, wait for the specified number of seconds
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
pause 5
</pre>
	</div>
	<div class="refsection" id="id8338"><h2>Description</h2>
	  
	  <p>The <code class="function">pause</code>-command has many different names: You may write <code class="function">pause</code>, <code class="function">sleep</code> or <code class="function">wait</code> interchangeably; whatever you write, <span class="application">yabasic</span> will always do exactly the same.</p>
	  <p>The <code class="function">pause</code>-command will simply wait for the specified number of seconds. This may be a fractional number, so you may well wait less than a second. However, if you try to pause for a smaller and smaller interval (e.g. 0.1 seconds, 0.01 seconds, 0.001 seconds and so on) you will find that at some point <span class="application">yabasic</span> will not wait at all. The minimal interval that can be waited depends on the system (Unix, Windows) you are using.</p>
	  <p>The <code class="function">pause</code>-command cannot be interrupted. However, sometimes you may want the wait to be interruptible by simply pressing a key on the keyboard. In such cases you should consider using the <code class="function"><a class="link" href="#ref_inkey" title="inkey$">inkey$</a></code>-function, with a number of seconds as an argument).</p>
	</div>
	<div class="refsection" id="id8355"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
deg=0
do
  maxx=44+40*sin(deg)
  for x=1 to maxx
    print "*";
  next x
  pause 0.1+(maxx*maxx/(4*84*84))
  print
  deg=deg+0.1
loop
          </pre>
	    <p>This example draws a sine-curve; due to the <code class="function">pause</code>-statement the speed of drawing varies in the same way as the speed of a ball might vary, if it would roll along this curve under the influence of gravity.</p>
	  </div>
	</div>
	<div class="refsection" id="id8363"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_sleep" title="sleep">sleep</a></code>, <code class="function"><a class="link" href="#ref_wait" title="wait">wait</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_peek"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  peek
	   &#8212; retrieve various internal informations (numeric)
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print peek("foo")
a=peek(#1)
</pre>
	</div>
	<div class="refsection" id="id8380"><h2>Description</h2>
	  
	  <p>The <code class="function">peek</code>-function has many different and mostly unrelated uses. It is a kind of grab-bag for retrieving all kinds of numerical information, internal to <span class="application">yabasic</span>. The meaning of the numbers returned be the <code class="function">peek</code>-function depends on the string or number passed as an argument.</p>
	  <p><code class="function">peek</code> always returns a number, however the closely related <code class="function"><a class="link" href="#ref_peek2" title="peek$">peek$</a></code>-function exists, which may be used to retrieve string information from among the internals of <span class="application">yabasic</span>. Finally note, that some of the values which are retrieved with <code class="function">peek</code> may even be changed, using the <code class="function"><a class="link" href="#ref_poke" title="poke">poke</a></code>-function.</p>
	  <p>There are two variants of the <code class="function">peek</code>-function: One expects an integer, positive number and is described within the first entry of the list below. The other variant expects one of a well defined set of strings as described in the second and all the following entries of the list below (in alphabetical order).</p>

	  <div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="function">peek(a)</code></span></dt><dd>
		<p>Read a single byte (a number between 0 and 255) from the file <code class="literal">a</code> (which must be open of course). You may use the <code class="function"><a class="link" href="#ref_chr" title="chr$()">chr$</a></code>-function to convert this byte to a string of one character.</p>
		<p>As a special case, if the argument is zero: read a single byte from stdin.</p>		
	      </dd><dt><span class="term"><code class="function">peek("argument")</code></span></dt><dd>
		<p>Return the number of arguments, that have been passed to <span class="application">yabasic</span> at invocation time. E.g. if <span class="application">yabasic</span> has been called like this: <code class="literal">yabasic foo.yab bar baz</code>, then <code class="function">peek("argument")</code> will return 2. This is because <code class="literal">foo.yab</code> is treated as the name of the program to run, whereas <code class="literal">bar</code> and <code class="literal">baz</code> are considered arguments to the program, which are passed on the command line. <span class="emphasis"><em>Note</em></span>, that for windows-users, who tend to click on the icon (as opposed to starting <span class="application">yabasic</span> on the command line), this <code class="function">peek</code>will mostly return 0.</p>
		<p>The function <code class="function">peek("argument")</code> can be written as <code class="function">peek("arguments")</code> too.</p>
		<p>You will want to check out the corresponding function <code class="function"><a class="link" href="#ref_peek2" title="peek$">peek$("argument")</a></code> to actually <span class="emphasis"><em>retrieve</em></span> the arguments. <span class="emphasis"><em>Note</em></span>, that each call to <code class="function">peek$("argument")</code> reduces the number returned by <code class="function">peek("argument")</code>.</p>
	      </dd><dt><span class="term"><code class="function">peek("error")</code></span></dt><dd>
		<p>Return a number specifying the nature of the last error in an <code class="function">open</code>- or <code class="function">seek</code>-statement. Normally an error within an <code class="function">open</code>-statement immediately terminates your program with an appropriate error-message, so there is no chance and no need to learn more about the nature of the error. However, if you use <code class="function">open</code> as a condition (e.g. <code class="literal">if (open(#1,"foo")) &#8230;</code>) the outcome (success or failure) of the <code class="function">open</code>-operation will determine, if the condition evaluates to <code class="constant">true</code> or <code class="constant">false</code>. If now such an operation fails, your program will not be terminated and you might want to learn the reason for failure. This reason will be returned by <code class="function">peek("error")</code> (as a number) or by <code class="function">peek$("error")</code> (as a string)</p>
		<p>The table below shows the various error codes; the value returned by <code class="function">peek$("error")</code> explains the nature of the error. Note, that the codes 10,11 and 12 refer to the <code class="function">seek</code>-command.</p>
		
		<div class="table" id="id8451"><div class="table-title">Table&#160;7.1.&#160;Error codes</div><div class="table-contents">
		  
		  <table style="border-collapse: collapse; border-top: 1px solid ; border-bottom: 1px solid ; border-left: 1px solid ; border-right: 1px solid ; "><colgroup><col/><col/><col/></colgroup><thead><tr><th style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="function">peek("error")</code></th><th style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="function">peek$("error")</code></th><th style="border-bottom: 1px solid ; ">Explanation</th></tr></thead><tbody><tr><td style="text-align: center; border-right: 1px solid ; border-bottom: 1px solid ; ">2</td><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">Stream already in use</code></td><td style="border-bottom: 1px solid ; ">Do not try to open one and the same filenumber twice; rather <code class="function"><a class="link" href="#ref_close" title="close">close</a></code> it first.</td></tr><tr><td style="text-align: center; border-right: 1px solid ; border-bottom: 1px solid ; ">3</td><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">'x' is not a valid filemode</code></td><td style="border-bottom: 1px solid ; ">The optional <span class="emphasis"><em>filemode</em></span> argument, which may be passed to the <code class="function"><a class="link" href="#ref_open" title="open">open</a></code>-function, has an invalid value</td></tr><tr><td style="text-align: center; border-right: 1px solid ; border-bottom: 1px solid ; ">4</td><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">could not open 'foo'</code></td><td style="border-bottom: 1px solid ; ">The <code class="function">open</code>-call did not work, no further explanation is available.</td></tr><tr><td style="text-align: center; border-right: 1px solid ; border-bottom: 1px solid ; ">5</td><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">reached maximum number of open files</code></td><td style="border-bottom: 1px solid ; ">You have opened more files than your operating system permits.</td></tr><tr><td style="text-align: center; border-right: 1px solid ; border-bottom: 1px solid ; ">6</td><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">cannot open printer: already printing graphics</code></td><td style="border-bottom: 1px solid ; ">The commands <code class="function"><a class="link" href="#ref_open_printer" title="open printer">open printer</a></code> and <code class="function"><a class="link" href="#ref_open" title="open">open #1,printer</a></code> both open a printer (refer to their description for the difference). However, only one can be active at a time; if you try to do both at the same time, you will receive this error.</td></tr><tr><td style="text-align: center; border-right: 1px solid ; border-bottom: 1px solid ; ">7</td><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">could not open line printer</code></td><td style="border-bottom: 1px solid ; ">Well, it simply did not work.</td></tr><tr><td style="text-align: center; border-right: 1px solid ; border-bottom: 1px solid ; ">9</td><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">invalid stream number</code></td><td style="border-bottom: 1px solid ; ">An attempt to use an invalid (e.g. negative) stream number; example: <code class="literal">open(-1,"foo")</code></td></tr><tr><td style="text-align: center; border-right: 1px solid ; border-bottom: 1px solid ; ">10</td><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">could not position stream x to byte y</code></td><td style="border-bottom: 1px solid ; "><code class="function"><a class="link" href="#ref_seek" title="seek()">seek</a></code> did not work.</td></tr><tr><td style="text-align: center; border-right: 1px solid ; border-bottom: 1px solid ; ">11</td><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="computeroutput">stream x not open</code></td><td style="border-bottom: 1px solid ; ">You have tried to <code class="function"><a class="link" href="#ref_seek" title="seek()">seek</a></code> within a stream, that has not been opened yet.</td></tr><tr><td style="text-align: center; border-right: 1px solid ; ">12</td><td style="border-right: 1px solid ; "><code class="computeroutput">seek mode 'x' is none of begin,end,here</code></td><td>The argument, which has been passed to <code class="function"><a class="link" href="#ref_seek" title="seek()">seek</a></code> is invalid.</td></tr></tbody></table>
		</div></div><br class="table-break"/>
	      </dd><dt><span class="term"><code class="function">peek("fontheight")</code></span></dt><dd>
		<p>Return the height of the font used within the graphic window. If none is open, this <code class="function">peek</code> will return the height of the last font used or 10, if no window has been opened yet.</p>
	      </dd><dt><span class="term"><code class="function">peek("isbound")</code></span></dt><dd>
		<p>Return <code class="constant">true</code>, if the executing <span class="application">yabasic</span>-program is part of a standalone program; see the section about <a class="link" href="#ref_standalone" title="Creating a standalone program from your yabasic-program">creating a <span class="emphasis"><em>standalone</em></span>-program</a> for details.</p>
	      </dd><dt><span class="term"><code class="function">peek("last_foreign_function_call_okay")</code></span></dt><dd>
		<p>Check for error: If passing <code class="literal">"no_error"</code> to <code class="function"><a class="link" href="#ref_foreign_function_call" title="foreign_function_call()">foreign_function_call</a></code>, any error (e.g. failure to load the specified library), will <span class="emphasis"><em>not</em></span> terminate your <span class="application">yabasic</span>-program but rather store a descriptive error message away for later retrieval. Later on you may then check <code class="function">peek("last_foreign_function_call_okay")</code> to find out, if something went wrong and retrieve a description with <code class="function"><a class="link" href="#ref_peek2" title="peek$">peek$("last_foreign_function_call_error_text")</a></code>.</p>
		<p>This peek can be abbreviated as <code class="function">peek("last_frnfn_call_okay")</code></p>
	      </dd><dt><span class="term"><code class="function">peek("millisrunning")</code></span></dt><dd>
		<p>Return the number of milliseconds, that have passed since the start of <span class="application">yabasic</span>. There is also a related <code class="literal">peek("secondsrunning")</code> for lower precision.</p>
	      </dd><dt><span class="term"><code class="function">peek("screenheight")</code></span></dt><dd>
		<p>Return the height in characters of the window, wherein yabasic runs. If you have not called <code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></code> yet, this <code class="function">peek</code>will return 0, regardless of the size of your terminal.</p>
	      </dd><dt><span class="term"><code class="function">peek("screenwidth")</code></span></dt><dd>
		<p>Return the width in characters of the window, wherein yabasic runs. If you have not called <code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></code> yet, this <code class="function">peek</code>will return 0, regardless of the size of your terminal.</p>
	      </dd><dt><span class="term"><code class="function">peek("secondsrunning")</code></span></dt><dd>
		<p>Return the number of seconds that have passed since the start of <span class="application">yabasic</span>. There is also a related <code class="literal">peek("millisrunning")</code> for higher precision.</p>
	      </dd><dt><span class="term"><code class="function">peek("version")</code></span></dt><dd>
		<p>Return the version number of <span class="application">yabasic</span>, e.g. 2.77. See also the related <code class="function"><a class="link" href="#ref_peek2" title="peek$">peek$("version")</a></code>, which returns nearly the same information (plus the patchlevel) as a string, e.g. <code class="literal">"2.77.1"</code>.</p>
	      </dd><dt><span class="term"><code class="function">peek("winheight")</code></span></dt><dd>
		<p>Return the height of the graphic-window in pixels. If none is open, this <code class="function">peek</code> will return the height of the last window opened or 100, if none has been opened yet.</p>
	      </dd><dt><span class="term"><code class="function">peek("winwidth")</code></span></dt><dd>
		<p>Return the width of the graphic-window in pixels. If none is open, this <code class="function">peek</code> will return the width of the last window opened or 100, if none has been opened yet.</p>
	      </dd></dl></div>
	</div>
	<div class="refsection" id="id8612"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open "foo" for reading as #1
open "bar" for writing as #2
while not eof(#1)
  poke #2,chr$(peek(#1));
wend
          </pre>
	    <p>This program will copy the file <code class="filename">foo</code> byte by byte to <code class="filename">bar</code>.</p>
	    <p>Note, that each <code class="function">peek</code> does something entirely different, and only one has been demonstrated above. Therefore you need to make up examples yourself for all the other <code class="function">peek</code>s.</p>
	  </div>
	</div>
	<div class="refsection" id="id8624"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_peek2" title="peek$">peek$</a></code>, <code class="function"><a class="link" href="#ref_poke" title="poke">poke</a></code>, <code class="function"><a class="link" href="#ref_open" title="open">open</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_peek2"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  peek$
	   &#8212; retrieve various internal informations (strings)
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print peek$("foo")
</pre>
	</div>
	<div class="refsection" id="id8643"><h2>Description</h2>
	  
	  <p>The <code class="function">peek$</code>-function has many different and unrelated uses. It is a kind of grab-bag for retrieving all kinds of string information, internal to <span class="application">yabasic</span>; the exact nature of the strings returned be the <code class="function">peek$</code>-function depends on the string passed as an argument.</p>
	  <p><code class="function">peek$</code> always returns a string, however the closely related <code class="function"><a class="link" href="#ref_peek" title="peek">peek</a></code>-function exists, which may be used to retrieve numerical information from among the internals of <span class="application">yabasic</span>. Finally note, that some of the values which are retrieved with <code class="function">peek$</code> may even be changed, using the <code class="function"><a class="link" href="#ref_poke" title="poke">poke</a></code>-function.</p>
	  <p>The following list shows all possible arguments to <code class="function">peek$</code> in alphabetical order:</p>

	  <div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="function">peek$("argument")</code></span></dt><dd>
		<p>Return one of the arguments, that have been passed to <span class="application">yabasic</span> at invocation time (the next call will return the the second argument, and so on). E.g. if <span class="application">yabasic</span> has been called like this: <code class="literal">yabasic foo.yab bar baz</code>, then the first call to <code class="function">peek$("argument")</code> will return <code class="literal">bar</code>. This is because <code class="literal">foo.yab</code> is treated as the name of the program to run, whereas <code class="literal">bar</code> and <code class="literal">baz</code> are considered arguments to this program, which are passed on the command line. The second call to <code class="function">peek$("argument")</code> will return <code class="literal">baz</code>. <span class="emphasis"><em>Note</em></span>, that for windows-users, who tend to click on the icon (as opposed to starting <span class="application">yabasic</span> on the command line), this <code class="function">peek</code>will mostly return the empty string.</p>
		<p>Note, that <code class="function">peek$("argument")</code> can be written as <code class="function">peek$("arguments")</code>.</p>
		<p>Probably you will want to check out the corresponding function <code class="function"><a class="link" href="#ref_peek" title="peek">peek("argument")</a></code>.</p>
		<p>See further down <a class="link" href="#peek2_argument" title="Example&#160;7.1.&#160;Retrieving program-arguments">below</a> for an example of poking fore- and background color.</p>
	      </dd><dt><span class="term"><code class="function">peek$("env","<em class="replaceable"><code>NAME</code></em>")</code></span></dt><dd>
		<p>Return the environment variable specified by <em class="replaceable"><code>NAME</code></em> (which may be any string expression). Which kind of environment variables are available on your system depends, as well as their meaning, on your system; however typing <span class="command"><strong>env</strong></span> on the command line will produce a list (for Windows and Unix alike). Note, that <code class="function">peek$("env",...)</code> can be written as <code class="function">peek$("environment",...)</code> too.</p>
	      </dd><dt><span class="term"><code class="function">peek$("error")</code></span></dt><dd>
		<p>Return a string describing the nature of the last error in an <code class="function">open</code>- or <code class="function">seek</code>-statement. See the corresponding <code class="function"><a class="link" href="#ref_peek" title="peek">peek("error")</a></code> for a detailed description.</p>
	      </dd><dt><span class="term"><code class="function">peek$("font")</code></span></dt><dd>
		<p>Return the name of the font, which is used for text within the graphic window; this value can be specified as the third argument to the <code class="function"><a class="link" href="#ref_open_window" title="open window">open window</a></code>-command.</p>
	      </dd><dt><span class="term"><code class="function">peek$("infolevel")</code></span></dt><dd>
		<p>Returns either <code class="literal">"debug"</code>, <code class="literal">"note"</code>, <code class="literal">"warning"</code>, <code class="literal">"error"</code> or <code class="literal">"fatal"</code>, depending on the current infolevel. This value can be specified with an <a class="link" href="#chapter_options" title="Chapter&#160;4.&#160;Command line options of yabasic">option</a> on the command line or changed during the execution of the program with the corresponding <code class="function"><a class="link" href="#ref_poke" title="poke">poke</a></code>; however, normally only the author of <span class="application">yabasic</span> (<span class="emphasis"><em>me</em></span> !) would want to change this from its default value <code class="literal">"warning"</code>.</p>
	      </dd><dt><span class="term"><code class="function">peek$("interpreter_path")</code></span></dt><dd>
		<p>Return the full file-name of the <span class="application">yabasic</span>-interpreter that is currently executing your program; typically this will end on <code class="filename">yabasic</code> or <code class="filename">yabasic.exe</code> depending on your platform and the path will be where you installed <span class="application">yabasic</span>. For bound programs (see <a class="link" href="#ref_standalone" title="Creating a standalone program from your yabasic-program">creating a <span class="emphasis"><em>standalone</em></span>-program</a>) however, this may be different and will include whatever you specified during the <code class="function"><a class="link" href="#ref_bind" title="bind()">bind</a></code>-command.</p>
		<p>See also <code class="function">peek$("program_name")</code> and <code class="function">peek$("program_file_name")</code> for related information. Employing these, it would be possible for a <span class="application">yabasic</span>-program to start itself: <code class="function">system(peek$("interpreter_path") + " " + peek$("program_file_name"))</code>. Of course, in this simple form this would be a bad idea, because this would start concurrent instances of <span class="application">yabasic</span> without end.</p>
	      </dd><dt><span class="term"><code class="function">peek$("last_foreign_function_call_error_text")</code></span></dt><dd>
		<p>Retrieve error text: If passing <code class="literal">"no_error"</code> to <code class="function"><a class="link" href="#ref_foreign_function_call" title="foreign_function_call()">foreign_function_call</a></code>, any error (e.g. failure to load the specified library), will <span class="emphasis"><em>not</em></span> terminate your <span class="application">yabasic</span>-program but rather store a descriptive error message away for later retrieval. Later on you may then check <code class="function"><a class="link" href="#ref_peek" title="peek">peek("last_foreign_function_call_okay")</a></code> to find out, if something went wrong and retrieve a description with <code class="function">peek$("last_foreign_function_call_error_text")</code>.</p>
		<p>This peek can be abbreviated as <code class="function">peek$("last_frnfn_call_error_text")</code></p>
	      </dd><dt><span class="term"><code class="function">peek$("library")</code></span></dt><dd>
		<p>Return the name of the library, this statement is contained in. See the <code class="function"><a class="link" href="#ref_import" title="import">import</a></code>-command for a detailed description or for more about libraries.</p>
	      </dd><dt><span class="term"><code class="function">peek$("os")</code></span></dt><dd>
		<p>This <code class="function">peek</code> returns the name of the operating system, where your program executes. This can be either <code class="literal">windows</code> or <code class="literal">unix</code>.</p>
	      </dd><dt><span class="term"><code class="function">peek$("program_file_name")</code></span></dt><dd>
		<p>Returns the full file-name of the <span class="application">yabasic</span>-program that is currently executing; typically this is the name, that you have specified on the commandline, including any path-components. For the special case, that you have bound your <span class="application">yabasic</span>-program with the interpreter to a single <a class="link" href="#ref_standalone" title="Creating a standalone program from your yabasic-program">standalone</a> executable, this <code class="function">peek$</code> will return its name. See also <code class="function">peek$("program_name")</code> and <code class="function">peek$("interpreter_path")</code> for related information.</p>
	      </dd><dt><span class="term"><code class="function">peek$("program_name")</code></span></dt><dd>
		<p>Returns the name of the <span class="application">yabasic</span>-program that is currently executing; typically this is the name, that you have specified on the commandline, but without any path-components. So this <code class="function">peek$</code> might return <code class="filename">foo.yab</code>. As a special case when <span class="application">yabasic</span> has been invoked without the name of a program to be executed this peek will return the literal strings <code class="literal">standard input</code> or, when also the option <code class="literal">-e</code> has been specified, <code class="literal">command line</code>. See also <code class="function">peek$("program_file_name")</code> and <code class="function">peek$("interpreter_path")</code> for related information.</p>
	      </dd><dt><span class="term"><code class="function">peek$("textalign")</code></span></dt><dd>
		<p>Returns one of nine possible strings, specifying the default alignment of text within the graphics-window. The alignment-string returned by this <code class="function">peek</code> describes, how the <code class="function"><a class="link" href="#ref_text" title="text">text</a></code>-command aligns its string-argument with respect to the coordinates supplied. However, this value does <span class="emphasis"><em>not apply</em></span>, if the <code class="function">text</code>-command explicitly specifies an alignment. Each of these strings is two characters long. The first character specifies the horizontal alignment and can be either <code class="literal">l</code>, <code class="literal">r</code> or <code class="literal">c</code>, which stand for <em class="wordasword">left</em>, <em class="wordasword">right</em> or <em class="wordasword">center</em>. The second character specifies the vertical alignment and can be one of <code class="literal">t</code>, <code class="literal">b</code> or <code class="literal">c</code>, which stand for <em class="wordasword">top</em>, <em class="wordasword">bottom</em> or <em class="wordasword">center</em> respectively.</p>
		<p>You may change this value with the corresponding command <code class="function">poke "textalign",&#8230;</code>; the initial value is <code class="literal">lb</code>, which means the top of the left and the top edge if the text will be aligned with the coordinates, that are specified within the <code class="function">text</code>-command.</p>
	      </dd><dt><span class="term"><code class="function">peek$("version")</code></span></dt><dd>
		<p>Version of <span class="application">yabasic</span> as a string; e.g. <code class="literal">2.77.1</code>. See also the related <code class="function"><a class="link" href="#ref_peek" title="peek">peek("version")</a></code>, which returns nearly the same information (minus the patchlevel) as a number, e.g. <code class="literal">2.77</code>.</p>
	      </dd><dt><span class="term"><code class="function">peek$("windoworigin")</code></span></dt><dd>
		<p>This <code class="function">peek</code> returns a two character string, which specifies the position of the origin of the coordinate system of the window; this string might be changed with the corresponding command <code class="function">poke "windoworigin",x,y</code> or specified as the argument of the <code class="function"><a class="link" href="#ref_origin" title="window origin">origin</a></code> command; see there for a detailed description of the string, which might be returned by this <code class="function">peek</code>.</p>
	      </dd></dl></div>


	</div>
	<div class="refsection" id="id8850"><h2>Example</h2>	  
	<div class="example" id="peek2_argument"><div class="example-title">Example&#160;7.1.&#160;Retrieving program-arguments</div><div class="example-contents">
	  
	    <pre class="programlisting">
print "You have supplied these arguments: "
while peek("argument")
  print peek("argument"),peek$("argument")
wend
          </pre>
	    <p>If you save this program in a file <code class="filename">foo.yab</code> and execute it via <strong class="userinput"><code>yabasic t.yab a b c</code></strong> (for windows users: please use the command line for this), your will get this output:</p>
	    <pre class="screen">
3a
2b
1c
</pre>
	  </div></div><br class="example-break"/>
	</div>
	<div class="refsection" id="id8861"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_peek" title="peek">peek</a></code>, <code class="function"><a class="link" href="#ref_poke" title="poke">poke</a></code>, <code class="function"><a class="link" href="#ref_open" title="open">open</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_pi"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  pi
	   &#8212; a constant with the value <code class="computeroutput">3.14159</code>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print pi
</pre>
	</div>
	<div class="refsection" id="id8881"><h2>Description</h2>
	  
	  <p><code class="function">pi</code> is <code class="literal">3.14159265359</code> (well at least for <span class="application">yabasic</span>); do not try to assign to pi (e.g. <code class="literal">pi=22/7</code>) this would not only be mathematically dubious, but would also result in a syntax error.</p>
	</div>
	<div class="refsection" id="id8890"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=0 to 180
  print "The sine of ",a," degrees is ",sin(a*pi/180)
next a
          </pre>
	    <p>This program uses <code class="function">pi</code> to transform an angle from degrees into radians.</p>
	  </div>
	</div>
	<div class="refsection" id="id8898"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_euler" title="euler">euler</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_poke"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  poke
	   &#8212; change selected internals of <span class="application">yabasic</span>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
poke "foo","bar"
poke "foo",baz
poke #a,"bar"
poke #a,baz
</pre>
	</div>
	<div class="refsection" id="id8914"><h2>Description</h2>
	  
	  <p>The <code class="function">poke</code>-command may be used to change details of <span class="application">yabasic</span>'s behaviour. Like the related function <code class="function">peek</code>, <code class="function">poke</code> does many different things, depending on the arguments supplied.</p>
	  <p>Here are the different things you can do with <code class="function">poke</code> (alphabetical order):</p>
	  <div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="function">poke 5,a</code></span></dt><dd>
		<p>Write the given byte (<code class="literal">a</code> in the example above) to the specified stream (<code class="literal">5#a</code> in the example).</p>
		<p>See also the related function function <code class="function"><a class="link" href="#ref_peek" title="peek">peek(1)</a></code>.</p>
	      </dd><dt><span class="term"><code class="function">poke "console_foreground_intensity","bright"</code></span></dt><dd>
		<p>This <code class="function">poke</code> sets the intensity of the foreground colours used by <span class="application">yabasic</span>. This needs to be done before calling <code class="function">clear screen</code> and cannot be changed afterwards. Therefore your program still may use only the standard set of colors (<code class="literal">"black"</code>, <code class="literal">"white"</code>, <code class="literal">"red"</code>, <code class="literal">"blue"</code>, <code class="literal">"green"</code>, <code class="literal">"yellow"</code>, <code class="literal">"cyan"</code> or <code class="literal">"magenta"</code>) but, depending on this poke, they show up differently:</p>

      <div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">"legacy"</code></span></dt><dd>
	    <p>The color-intensity used in prior versions of <span class="application">yabasic</span>. This is the default and looks similar to <code class="literal">"normal"</code> (see below) but with a brighter yellow.</p>
	  </dd><dt><span class="term"><code class="literal">"normal"</code></span></dt><dd>
	    <p>Normal colors, with low intensity.</p>
	  </dd><dt><span class="term"><code class="literal">"bright"</code></span></dt><dd>
	    <p>Bright colors, with high intensity; this makes the output of your program bright.</p>
	  </dd></dl></div>
      <p>There are two synonyms for <code class="literal">"console_foreground_intensity"</code>: <code class="literal">"screen_foreground_intensity"</code> and <code class="literal">"terminal_foreground_intensity"</code>.</p>
      <p>See also <code class="function"><a class="link" href="#ref_print_color" title="print or input with color">print color</a></code> for how to print in color.</p>
	      </dd><dt><span class="term"><code class="function">poke "console_foreground_color","red"</code></span></dt><dd>
		<p>Use this <code class="function">poke</code> to set the <span class="emphasis"><em>default</em></span> forground color used for <a class="link" href="#ref_print" title="print"><code class="function">print</code></a> and <a class="link" href="#ref_input" title="input"><code class="function">input</code></a> statements, that do not specify a color themselves. Use this in conjunction with the <code class="function">poke "console_background_color"</code> and issue it before calling <a class="link" href="#ref_clear_screen" title="clear screen"><code class="function">clear screen</code></a>. After this the console-window of <span class="application">yabasic</span> will change its background color and all text will come out in the given color with no need to use an explicit <code class="function"><a class="link" href="#ref_print_color" title="print or input with color">color</a></code> clause (which of course is still possible to get different colors).</p>
		<p>The second argument (<code class="literal">"red"</code> in the example above) is one of the 8 colours known to <span class="application">yabasic</span>. For completeness, there are also matching types of <a class="link" href="#ref_peek2" title="peek$">peek$</a> to retrieve these values. Finally note, that this can be done only once within your program, as it is only possible before <a class="link" href="#ref_clear_screen" title="clear screen"><code class="function">clear screen</code></a>.</p>
		<p>See further down <a class="link" href="#poke_color" title="Example&#160;7.2.&#160;Poking fore- and background color">below</a> for an example of poking fore- and background color.</p>
	      </dd><dt><span class="term"><code class="function">poke "console_background_color","green"</code></span></dt><dd>
		<p>Use this <code class="function">poke</code> to set the <span class="emphasis"><em>default</em></span> forground color used for <a class="link" href="#ref_print" title="print"><code class="function">print</code></a> and <a class="link" href="#ref_input" title="input"><code class="function">input</code></a> statements, that do not specify a color themselves. Use this in conjunction with the <code class="function">poke "console_foreground_color"</code>; see there for more details.</p>
		<p>See further down <a class="link" href="#poke_color" title="Example&#160;7.2.&#160;Poking fore- and background color">below</a> for an example of poking fore- and background color.</p>
	      </dd><dt><span class="term"><code class="function">poke "debug_internal","which kind of internal debugging ?"</code></span></dt><dd>
		<p>Invoke one of various internal debugging facilities;
		this is only useful for debugging the internals of <span class="application">yabasic</span> itself.</p>
		<p>The second argument (<code class="literal">"which kind of internal debugging ?"</code>
in the example) can be one of several strings, which are not described here, because they
tend to change quickly and are in general not useful for the programmer using <span class="application">yabasic</span>.
However, if you give an invalid argument, e.g. <code class="function">poke "debug_internal","?"</code>, the error-message will list and explain the valid arguments briefly.</p>
	      </dd><dt><span class="term"><code class="function">poke "dump","filename.dump"</code></span></dt><dd>
		<p>Dump the internal form of your
<abbr class="acronym">basic</abbr>-program to the named file; this is only useful for
debugging the internals of <span class="application">yabasic</span> itself.</p>
		<p>The second argument (<code class="literal">"filename.dump"</code>
in the example) should be the name of a file, that
gets overwritten with the dump, please be careful.</p>
	      </dd><dt><span class="term"><code class="function">poke "font","fontname"</code></span></dt><dd>
		<p>This <code class="function">poke</code> specifies the default font. This can only have an effect, if you do not supply a fontname with the commands <code class="function"><a class="link" href="#ref_text" title="text">text</a></code> or <code class="function"><a class="link" href="#ref_open_window" title="open window">open window</a></code>.</p>
	      </dd><dt><span class="term"><code class="function">poke "fontheight",12</code></span></dt><dd>
		<p>This <code class="function">poke</code> changes the default fontheight. This can only have an effect, if the fonts given in the commands <code class="function"><a class="link" href="#ref_text" title="text">text</a></code> or <code class="function"><a class="link" href="#ref_open_window" title="open window">open window</a></code> do not specify a fontheight on their own.</p>
	      </dd><dt><span class="term"><code class="function">poke "infolevel","debug"</code></span></dt><dd>
		<p>Change the amount of internal information, that <span class="application">yabasic</span> outputs during execution.</p>
		<p>The second argument can be either <code class="literal">"debug"</code>, <code class="literal">"note"</code>, <code class="literal">"warning"</code>, <code class="literal">"error"</code> or <code class="literal">"fatal"</code>. However, normally you will not want to change this from its default value <code class="literal">"warning"</code>.</p>
		<p>See also the related <code class="function"><a class="link" href="#ref_peek2" title="peek$">peek$("infolevel")</a></code>.</p>
		<p>See further down <a class="link" href="#poke_infolevel" title="Example&#160;7.3.&#160;Poking the infolevel">below</a> for an example of poking the infolevel.</p>		
	      </dd><dt><span class="term"><code class="function">poke "random_seed",42</code></span></dt><dd>
		<p>Set the seed for the random number generator; if you do this, the <code class="function"><a class="link" href="#ref_ran" title="ran()">ran</a></code>-function will return the same sequence of numbers every time the program is started.</p>
	      </dd><dt><span class="term"><code class="function">poke "stdout","some text"</code></span></dt><dd>
		<p>Send the given text to standard output. Normally one would use <code class="function"><a class="link" href="#ref_print" title="print">print</a></code> for this purpose; however, sending e.g. control characters to your terminal is easier with this <code class="function">poke</code>.</p>
	      </dd><dt><span class="term"><code class="function">poke "textalign","cc"</code></span></dt><dd>
		<p>This <code class="function">poke</code> changes the <span class="emphasis"><em>default</em></span> alignment of text with respect to the coordinates supplied within the <code class="function">text</code>-command. However, this value does <span class="emphasis"><em>not apply</em></span>, if the <code class="function">text</code>-command explicitly specifies an alignment. The second argument (<code class="literal">"cc"</code> in the example) must always be two characters long; the first character can be one of <code class="literal">l</code> (<em class="wordasword">left</em>), <code class="literal">r</code> (<em class="wordasword">right</em>) or <code class="literal">c</code> (<em class="wordasword">center</em>); the second character can be either <code class="literal">t</code> (<em class="wordasword">top</em>), <code class="literal">b</code> (<em class="wordasword">bottom</em>) or <code class="literal">c</code> (<em class="wordasword">center</em>); see the corresponding <code class="function"><a class="link" href="#ref_peek2" title="peek$">peek$("textalign")</a></code> for a detailed description of this argument.</p>
	      </dd><dt><span class="term"><code class="function">poke "windoworigin","lt"</code></span></dt><dd>
		<p>This <code class="function">poke</code> moves the origin of the coordinate system of the window to the specified position. The second argument (<code class="literal">"lt"</code> in the example) must always be two characters long; the first character can be one of <code class="literal">l</code> (<em class="wordasword">left</em>), <code class="literal">r</code> (<em class="wordasword">right</em>) or <code class="literal">c</code> (<em class="wordasword">center</em>); the second character can be either <code class="literal">t</code> (<em class="wordasword">top</em>), <code class="literal">b</code> (<em class="wordasword">bottom</em>) or <code class="literal">c</code> (<em class="wordasword">center</em>). Together those two characters specify the new position of the coordinate-origin. See the corresponding <code class="function"><a class="link" href="#ref_peek2" title="peek$">peek$("windoworigin")</a></code> for a more in depth description of this argument.</p>
	      </dd></dl></div>	  
	</div>
	<div class="refsection" id="id9134"><h2>Examples</h2>


<div class="example" id="poke_color"><div class="example-title">Example&#160;7.2.&#160;Poking fore- and background color</div><div class="example-contents">

<pre class="programlisting">
poke "console_foreground_color", "yellow"
poke "console_background_color", "green"
clear screen
print "Screen background should be all green with yellow text by default."
print color("black") "Black on green"
input color("red","white") "Red on white; press RETURN " a$
</pre>
<p>See the code above for the colors expected from each of the statements.</p>
</div></div><br class="example-break"/>


<div class="example" id="poke_infolevel"><div class="example-title">Example&#160;7.3.&#160;Poking the infolevel</div><div class="example-contents">

<pre class="programlisting">
print "Hello, now you will see, how much work"
print "a simple for-loop involves ..."
input "Please press return " a$
poke "infolevel","debug"
for a=1 to 10:next a
  </pre>
<p>The above code will produces lots of output detailing the many elementary operations in a for-loop.</p>
</div></div><br class="example-break"/>

	
	</div>


	<div class="refsection" id="id9146"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_peek2" title="peek$">peek$</a></code></p>
	</div>
	</div>

      <div class="refentry" id="ref_print"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  print
	   &#8212; Write to terminal or file
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print "foo",a$,b
print "foo",a$,b;
print #a "foo",a$
print #a "foo",a$;
print foo using "##.###"
print reverse "foo"
print at(10,10) a$,b
print @(10,10) a$,b
print color("red","blue") a$,b
print color("magenta") a$,b
print color("green","yellow") at(5,5) a$,b
</pre>
	</div>
	<div class="refsection" id="id9161"><h2>Description</h2>
	  
	  <p>The <code class="function">print</code>-statement outputs strings or characters, either to your terminal (also known as <em class="wordasword">console</em>) or to an open file.</p>
	  <p>To understand all those uses of the <code class="function">print</code>-statement, let's go through the various lines in the synopsis above:</p>
	  <div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">print "foo",a$,b</code></span></dt><dd>
		<p>Print the string <code class="literal">foo</code> as well as the contents of the variables <code class="literal">a$</code> and <code class="literal">b</code> onto the screen, silently adding a <span class="emphasis"><em>newline</em></span>.</p>
	      </dd><dt><span class="term"><code class="literal">print "foo",a$,b;</code></span></dt><dd>
		<p>(Note the trailing semicolon !) This statement does the same as the one above; only the implicit <span class="emphasis"><em>newline</em></span> is skipped, which means that the next <code class="function">print</code>-statement will append seamlessly.</p>
	      </dd><dt><span class="term"><code class="literal">print #a "foo",a$</code></span></dt><dd>
		<p>This is the way to write to files. The file with the number <code class="literal">a</code> must be open already, an implicit <span class="emphasis"><em>newline</em></span> is added. Note the file-number <code class="literal">#a</code>, which starts with a hash ('<code class="literal">#</code>') amd is separated from the rest of the statement by a space only. The file-number (contained in the variable <code class="literal">a</code>) must have been returned by a previous <code class="function"><a class="link" href="#ref_open" title="open">open</a></code>-statement (e.g. <code class="literal">a=open("bar")</code>).</p>
	      </dd><dt><span class="term"><code class="literal">print #a "foo",a$;</code></span></dt><dd>
		<p>The same as above, but without the implicit <span class="emphasis"><em>newline</em></span>.</p>
	      </dd><dt><span class="term"><code class="literal">print foo using "##.###"</code></span></dt><dd>
		<p>Print the number <code class="varname">foo</code> with as many digits before and after the decimal dot as given by the number of '<code class="literal">#</code>'-signs. See the entries for <code class="function"><a class="link" href="#ref_using" title="using">using</a></code> and <code class="function"><a class="link" href="#ref_str" title="str$()">str$</a></code> for a detailed description of this format.</p>
	      </dd><dt><span class="term"><code class="literal">print reverse "foo"</code></span></dt><dd>
		<p>As all the <code class="function">print</code>-variants to follow, this form of the <code class="function">print</code>-statement can only be issued after <code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></code> has been called. The strings and numbers after the <code class="literal">reverse</code>-clause are simply printed inverse (compared to the normal <code class="function">print</code>-statement).</p>
	      </dd><dt><span class="term"><code class="literal">print at(10,10) a$,b</code></span></dt><dd>
		<p>Print at the specified (x,y)-position. This is only allowed after <code class="function">clear screen</code> has been called. You may want to query <code class="function"><a class="link" href="#ref_peek2" title="peek$">peek$("screenwidth")</a></code> or <code class="function"><a class="link" href="#ref_peek2" title="peek$">peek$("screenheight")</a></code> to learn the actual size of your screen. You may add a semicolon to suppress the implicit newline.</p>
	      </dd><dt><span class="term"><code class="literal">print @(10,10) a$,b</code></span></dt><dd>
		<p>This is exactly the same as above, however, <code class="literal">at</code> may be written as <code class="literal">@</code>.</p>
	      </dd><dt><span class="term"><code class="literal">print color("red","blue") a$,b</code></span></dt><dd>
		<p>Print with the specified fore- (<code class="literal">"red"</code>) and background (<code class="literal">"blue"</code>) color (or colour). The possible values are <code class="literal">"black"</code>, <code class="literal">"white"</code>, <code class="literal">"red"</code>, <code class="literal">"blue"</code>, <code class="literal">"green"</code>, <code class="literal">"yellow"</code>, <code class="literal">"cyan"</code> or <code class="literal">"magenta"</code>. Again, you need to call <code class="literal">clear screen</code> first and add a semicolon if you want to suppress the implicit newline.</p>
		<p>Please note, that your program may choose to use these colours in <span class="emphasis"><em>bright</em></span>, <span class="emphasis"><em>normal</em></span> or <span class="emphasis"><em>legacy</em></span> variants, depending on the <code class="function"><a class="link" href="#ref_poke" title="poke">poke</a></code> <code class="literal">"console_foreground_intensity"</code>. And if you want to choose a pair or fore- and background colors for the whole program-run, you may <code class="function"><a class="link" href="#ref_poke" title="poke">poke</a></code> them into <code class="literal">"console_foreground_color"</code> and <code class="literal">"console_background_color"</code>; this needs to be done before calling <code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></code>; see <a class="link" href="#poke_color" title="Example&#160;7.2.&#160;Poking fore- and background color">here</a> for an example.</p>
	      </dd><dt><span class="term"><code class="literal">print color("magenta") a$,b</code></span></dt><dd>
		<p>You may specify the foreground color only.</p>
	      </dd><dt><span class="term"><code class="literal">print color("green","yellow") at(5,5) a$,b</code></span></dt><dd>
		<p>A color and a position (in this sequence, not the other way around) may be specified at once.</p>
	      </dd></dl></div>
	</div>
	<div class="refsection" id="id9285"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
clear screen
columns=peek("screenwidth")
lines=peek("screenheight")
dim col$(7)
for a=0 to 7:read col$(a):next a
data "black","white","red","blue","green","yellow","cyan","magenta"

for a=0 to 2*pi step 0.1
  print colour(col$(mod(i,8))) at(columns*(0.8*sin(a)+0.9)/2,lines*(0.8*cos(a)+0.9)/2) "*"
  i=i+1
next a
          </pre>
	    <p>This example draws a colored ellipse within the text window.</p>
	  </div>
	</div>
	<div class="refsection" id="id9292"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_at" title="at()">at</a></code>, <code class="function"><a class="link" href="#ref_print_color" title="print or input with color">print color</a></code>, <a class="link" href="#ref_input" title="input">input</a>, <code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></code>, <code class="function"><a class="link" href="#ref_using" title="using">using</a></code>, <code class="function"><a class="link" href="#ref_semicolon" title=";">;</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_print_color"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  print color
	   &#8212; print or input-prompt with color
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print color(fore$) text$
input color("green") "Press RETURN" t$
print color(fore$,back$) text$
</pre>
	</div>
	<div class="refsection" id="id9316"><h2>Description</h2>
	  
	  <p>Not a separate command, but part of the commands <a class="link" href="#ref_print" title="print"><code class="function">print</code></a> or <code class="function"><a class="link" href="#ref_input" title="input">input</a></code>; may be included just after <code class="function">print</code> and can only be issued after <code class="function">clear screen</code> has been executed.</p>
	  <p><code class="function">color()</code> takes one or two string-arguments, specifying the color of the text and (optionally) the background.</p>
	  <p>The one or two strings passed to <code class="function">color()</code> can be one of these: <code class="systemitem">"black"</code>, <code class="systemitem">"white"</code>, <code class="systemitem">"red"</code>, <code class="systemitem">"blue"</code>, <code class="systemitem">"green"</code>, <code class="systemitem">"yellow"</code>, <code class="systemitem">"cyan"</code> and <code class="systemitem">"magenta"</code> (which can be abbreviated as <code class="systemitem">"bla"</code>, <code class="systemitem">"whi"</code>, <code class="systemitem">"red"</code>, <code class="systemitem">"blu"</code>, <code class="systemitem">"gre"</code>, <code class="systemitem">"yel"</code>, <code class="systemitem">"cya"</code> and <code class="systemitem">"mag"</code> respectively).</p>
	  <p><code class="function">color()</code> can only be used, if <code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear scren</a></code> has been issued at least once.</p>
	  <p>Please note, that your program may choose to use these colours in <span class="emphasis"><em>bright</em></span>, <span class="emphasis"><em>normal</em></span> or <span class="emphasis"><em>legacy</em></span> variants, depending on the <code class="function"><a class="link" href="#ref_poke" title="poke">poke</a></code> <code class="literal">"console_foreground_intensity"</code>. And if you want to choose a pair or fore- and background colors for the whole program-run, you may <code class="function"><a class="link" href="#ref_poke" title="poke">poke</a></code> them into <code class="literal">"console_foreground_color"</code> and <code class="literal">"console_background_color"</code>; this needs to be done before calling <code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></code>; see <a class="link" href="#poke_color" title="Example&#160;7.2.&#160;Poking fore- and background color">here</a> for an example.</p>
	  <p>Note, that <code class="function">color()</code> can be written as <code class="function">colour()</code> too.</p>
	</div>
	<div class="refsection" id="id9368"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
clear screen
dim col$(7):for a=0 to 7:read col$(a):next a
do
  print color(col$(ran(7)),col$(ran(7))) " Hallo ";
  pause 0.01
loop
data "black","white","red","blue"
data "green","yellow","cyan","magenta"
          </pre>
	    <p>This prints the word <code class="systemitem">" Hallo "</code> in all colors across your screen.</p>
	  </div>
	</div>
	<div class="refsection" id="id9376"><h2>See also</h2>	  
	  <p><code class="function"><a class="link" href="#ref_print" title="print">print</a></code>, <code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></code>, <code class="function"><a class="link" href="#ref_at" title="at()">at</a></code>, <code class="function"><a class="link" href="#ref_poke" title="poke">poke</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_print_colour"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  print colour
	   &#8212; see <code class="function">print color</code>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print colour(fore$) text$
print colour(fore$,back$) text$
</pre>
	</div>
	<div class="refsection" id="id9398"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_print_color" title="print or input with color">color</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_putbit"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  putbit
	   &#8212; draw a rectangle of pixels encoded within a string into the graphics window
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
open window 200,200
&#8230;
a$=getbit(20,20,50,50)
&#8230;
putbit a$,30,30
putbit a$ to 30,30
putbit a$,30,30,"or"
</pre>
	</div>
	<div class="refsection" id="id9413"><h2>Description</h2>
	  
	  <p>The <code class="function">putbit</code>-command is the counterpart of the <code class="function"><a class="link" href="#ref_getbit" title="getbit$()">getbit$</a></code>-function. <code class="function">putbit</code> requires a string as returned by the <code class="function"><a class="link" href="#ref_getbit" title="getbit$()">getbit</a></code>-function. Such a string contains a rectangle from the graphic window; the <code class="function">putbit</code>-function puts such a rectangular region back into the graphic-window.</p>
	  <p>Note, that the <code class="function">putbit</code>-command currently accepts a fourth argument. However only the string value <code class="literal">"or"</code> is supported here. The effect is, that only those pixel, which are set in the string will be set in the graphic window. Those pixels, which are not set in the string, will not change in the window (as opposed to being cleared).</p>
	</div>
	<div class="refsection" id="id9428"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
repeat
  read d$
  c$ = c$ + d$
until( d$ = "")

open window 200,200

do
  x=ran(220)-10
  y=ran(220)-10
  putbit c$,x,y,"transparent"
loop
  
data "rgb 21,21:00000000000000000000000000000000000000000000000000000000000000"
data "32c800000000000000000000000000000000000000000000000000000000000000000000"
data "00000000000000000000000000000032c80032c80032c80032c80032c80032c80032c800"
data "32c80032c800000000000000000000000000000000000000000000000000000000000000"
data "32c80032c80032c80032c80032c80032c80032c80032c80032c80032c80032c80032c800"
data "00000000000000000000000000000000000000000000000032c80032c80032c80032c800"
data "32c80032c80032c80032c80032c80032c80032c80032c80032c80032c80032c800000000"
data "00000000000000000000000032c80032c80032c80032c80032c80032c80032c80032c8c8"
data "ff000032c80032c80032c80032c80032c80032c80032c800000000000000000000000000"
data "00000032c80032c80032c80032c80032c8c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8"
data "ff000032c80032c80032c80032c80032c80000000000000000000032c80032c80032c800"
data "32c80032c8c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff000032c800"
data "32c80032c80032c80032c80000000000000032c80032c80032c80032c8c8ff00c8ff00c8"
data "ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff000032c80032c80032c800"
data "32c80000000000000032c80032c80032c80032c8c8ff00c8ff00c8ff00c8ff00c8ff00c8"
data "ff00c8ff00c8ff00c8ff00c8ff00c8ff000032c80032c80032c80032c800000000000000"
data "32c80032c80032c80032c8c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8"
data "ff00c8ff00c8ff000032c80032c80032c80032c80000000032c80032c80032c80032c8c8"
data "ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff0000"
data "32c80032c80032c80032c80000000000000032c80032c80032c80032c8c8ff00c8ff00c8"
data "ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff000032c80032c80032c800"
data "32c80000000000000032c80032c80032c80032c8c8ff00c8ff00c8ff00c8ff00c8ff00c8"
data "ff00c8ff00c8ff00c8ff00c8ff00c8ff000032c80032c80032c80032c800000000000000"
data "32c80032c80032c80032c8c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8"
data "ff00c8ff00c8ff000032c80032c80032c80032c80000000000000032c80032c80032c800"
data "32c80032c8c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff000032c800"
data "32c80032c80032c80032c80000000000000000000032c80032c80032c80032c80032c8c8"
data "ff00c8ff00c8ff00c8ff00c8ff00c8ff00c8ff000032c80032c80032c80032c80032c800"
data "00000000000000000000000032c80032c80032c80032c80032c80032c80032c80032c800"
data "32c80032c80032c80032c80032c80032c80032c80032c800000000000000000000000000"
data "00000000000032c80032c80032c80032c80032c80032c80032c80032c80032c80032c800"
data "32c80032c80032c80032c80032c800000000000000000000000000000000000000000000"
data "32c80032c80032c80032c80032c80032c80032c80032c80032c80032c80032c80032c800"
data "00000000000000000000000000000000000000000000000000000000000000000032c800"
data "32c80032c80032c80032c80032c80032c80032c80032c800000000000000000000000000"
data "000000000000000000000000000000000000000000000000000000000000000000000000"
data "0000000000000000000000000000000000000000000000000000000000000000"
data ""
            </pre>
	    <p>This program uses a precanned string (containing the image of a blue circle with a yellow centre) and draws it repeatedly into the graphic-window. The mode <code class="literal">"transparent"</code> ensures, that no pixels will be cleared.</p>
	  </div>
	  <p>There are two possible values for the third argument of <code class="function">putbit</code>. Both modes differ in the way, they replace (or not) any pixels from the window with pixels from the bitmap having the background colour.</p>
	  <div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">transparent</code> or <code class="literal">t</code></span></dt><dd>
		<p>With this mode the pixels from the window will be kept, if the bitmap contains pixels with background colour at this position; i.e. the bitmap is <span class="emphasis"><em>transparent</em></span></p>
	  </dd><dt><span class="term"><code class="literal">solid</code> or <code class="literal">s</code></span></dt><dd>
		<p>With this mode the pixels from the window will be overpainted with the pixels from the bitmap in any case; i.e. the bitmap is <span class="emphasis"><em>solid</em></span></p>
	  </dd></dl></div>

	  <p>If you omit this argument, the default <code class="literal">transparent</code> applies.</p>

	</div>
	<div class="refsection" id="id9455"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_getbit" title="getbit$()">getbit$</a></code>, <code class="function"><a class="link" href="#ref_open_window" title="open window">open window</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_putscreen"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  putscreen
	   &#8212; draw a rectangle of characters into the text terminal
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
clear screen
&#8230;
a$=getscreen$(5,5,10,10)
&#8230;
putscreen a$,7,7
</pre>
	</div>
	<div class="refsection" id="id9472"><h2>Description</h2>
	  
	  <p>The <code class="function">putscreen</code>-command is the counterpart of the <code class="function"><a class="link" href="#ref_getscreen" title="getscreen$()">getscreen$</a></code>-function. <code class="function">putscreen</code> requires a string as returned by the <code class="function"><a class="link" href="#ref_getscreen" title="getscreen$()">getscreen</a></code>-function. Such a string contains a rectangular detail from the terminal; the <code class="function">putscreen</code>-function puts such a region back into the terminal-window.</p>
	  <p>Note, that <code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></code> must have been called before.</p>
	</div>
	<div class="refsection" id="id9487"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
clear screen
for a=1 to 200
  print color("red") "Hallo !"; 
  print color("blue") "Welt !";
next a
r$=getscreen$(0,0,20,20)
for x=0 to 60
  putscreen r$,x,0
  sleep 0.1
next x
          </pre>
	    <p>This example prints the string <code class="literal">"Hallo !Welt !"</code> all over the screen and then moves a rectangle from one side to the other.</p>
	  </div>
	</div>
	<div class="refsection" id="id9495"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_getscreen" title="getscreen$()">getscreen$</a></code>, <code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></code></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_r"><div class="titlepage"><div><div><h2 class="title" style="clear: both">R</h2></div></div></div>
      

      <div class="refentry" id="ref_ran"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  ran()
	   &#8212; return a random number
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print ran()
x=ran(y)
</pre>
	</div>
	<div class="refsection" id="id9516"><h2>Description</h2>
	  
	  <p>The <code class="function">ran</code>-function returns a random number. If no argument is given, the number returned is in the range from 0 to 1; where only 0 is a possible value; 1 will never be returned. If an argument is supplied, the number returned will be in the range from 0 up to this argument, whereas this argument itself is not a possible return value. Regardless of the range, <code class="function">ran</code> is guaranteed to have exactly 2**30 different return values.</p>

	  <p>If you call <code class="function">ran</code> multiple times during your program, the sequence of random numbers will be different each time you invoke your program; however, if, e.g. for testing you prefer to always have the same sequence of random numbers you may issue <code class="function"><a class="link" href="#ref_poke" title="poke">poke "random_seed",123</a></code>.</p>
	</div>
	<div class="refsection" id="id9527"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
clear screen
c=peek("screenwidth")-1
l=peek("screenheight")

dim col$(8)
for a=0 to 7:read col$(a):next a
data "black","white","red","blue","green","yellow","cyan","magenta"

do
  x=ran(c)
  y=l-ran(l*exp(-32*((x/c-1/2)**2)))
  i=i+1
  print color(col$(mod(i,8))) at(x,y) "*";
loop
          </pre>
	    <p>This example will print a colored bell-curve.</p>
	  </div>
	</div>
	<div class="refsection" id="id9534"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_int" title="int()">int</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_read"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  read
	   &#8212; read data from <code class="function">data</code>-statements
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
read a$,a
&#8230;
data "Hello !",7
</pre>
	</div>
	<div class="refsection" id="id9550"><h2>Description</h2>
	  
	  <p>The <code class="function">read</code>-statement retrieves literal data, which is stored within <code class="function">data</code>-statements elsewhere in your program.</p>
	</div>
	<div class="refsection" id="id9557"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
read num
dim col$(num)
for a=1 to num:read col$(a):next a
clear screen
print "These are the colours known to yabasic:\n"
for a=1 to num
  print colour(col$(a)) col$(a)
next a

data 8,"black","white","red","blue"
data "green","yellow","cyan","magenta"
          </pre>
	    <p>This program prints the names of the colors known to <span class="application">yabasic</span> in those very colors.</p>
	  </div>
	</div>
	<div class="refsection" id="id9565"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_data" title="data">data</a>, <code class="function"><a class="link" href="#ref_restore" title="restore">restore</a></code></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_rectangle"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  rectangle
	   &#8212; draw a rectangle
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
open window 100,100
rectangle 10,10 to 90,90
rectangle 20,20,80,80
rect 20,20,80,80
box 30,30,70,70
clear rectangle 30,30,70,70
fill rectangle 40,40,60,60
clear fill rectangle 60,60,40,40
</pre>
	</div>
	<div class="refsection" id="id9582"><h2>Description</h2>
	  
	  <p>The <code class="function">rectangle</code>-command (also known as <code class="function">box</code> or <code class="function">rect</code>, for short) draws a rectangle; it accepts four parameters: The x- and y-coordinates of two facing corners of the rectangle. With the optional clauses <code class="function">clear</code> and <code class="function">fill</code> (which may appear together and in any sequence) the rectangle can be cleared and filled respectively.</p>
	</div>
	<div class="refsection" id="id9592"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
c=1
do 
  for phi=0 to pi step 0.1
    if (c) then 
      rectangle 100+100*sin(phi),100+100*cos(phi) to 100-100*sin(phi),100-100*cos(phi)
    else 
      clear rectangle 100+100*sin(phi),100+100*cos(phi) to 100-100*sin(phi),100-100*cos(phi)
    endif
    sleep 0.1
  next phi
  c=not c
loop
          </pre>
	    <p>This example draws a nice animated pattern; watch it for a couple of hours, to see how it develops.</p>
	  </div>
	</div>
	<div class="refsection" id="id9599"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_open_window" title="open window">open window</a></code>, <code class="function"><a class="link" href="#ref_open_printer" title="open printer">open printer</a></code>, <code class="function"><a class="link" href="#ref_line" title="line">line</a></code>, <code class="function"><a class="link" href="#ref_circle" title="circle">circle</a></code>, <code class="function"><a class="link" href="#ref_triangle" title="triangle">triangle</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_redim"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  redim
	   &#8212; create an array prior to its first use. A synonym for <code class="function">dim</code>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
See the <code class="function"><a class="link" href="#ref_dim" title="dim">dim</a></code>-command.
</pre>
	</div>
	<div class="refsection" id="id9625"><h2>Description</h2>
	  
	  <p>The <code class="function">redim</code>-command does exactly the same as the <code class="function"><a class="link" href="#ref_dim" title="dim">dim</a></code>-command; it is just a <span class="emphasis"><em>synonym</em></span>. <code class="function">redim</code> has been around in older versions of <abbr class="acronym">basic</abbr> (not even <span class="application">yabasic</span>) for many years; therefore it is supported in <span class="application">yabasic</span> for compatibility reasons.</p>
	  <p>Please refer to the entry for the <code class="function"><a class="link" href="#ref_dim" title="dim">dim</a></code>-command for further information.</p>
	</div>
      </div>

      <div class="refentry" id="ref_rem"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  rem
	   &#8212; start a comment
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
rem  Hey, this is a comment
#    the hash-sign too (at beginning of line)
// even the double slash
' and the single quote (at beginning of line)
print "Not a comment" #    This is an error !!
print "Not a comment"://   But this is again a valid comment
print "Not a comment" //   even this.
print "Not a comment" rem  and this !
</pre>
	</div>
	<div class="refsection" id="id9649"><h2>Description</h2>
	  
	  <p><code class="function">rem</code> introduces a comment (like <code class="literal">#</code> or <code class="literal">//</code>), that extends up to the end of the line.</p>
	  <p>Those comments do not even need a colon
('<code class="literal">:</code>') in front of them; they (<code class="literal">rem</code>, <code class="literal">#</code>, <code class="literal">'</code> (single quite) and <code class="literal">//</code>) all behave alike except for <code class="literal">#</code> and <code class="literal">'</code>, which may only appear at the very beginning of a line; therefore the fourth example in the synopsis above (<code class="literal">print "Not a comment" #    This is an error !!</code>) is indeed an error.</p>
	  <p>Note, that <code class="function">rem</code> is an abbreviation for <span class="emphasis"><em>remark</em></span>. <code class="function">remark</code> however is <span class="emphasis"><em>not</em></span> a valid command in <span class="application">yabasic</span>.</p>
	  <p>Finally note, that a comment introduced with '<code class="literal">#</code>' may have a special meaning under unix; see the entry for <a class="link" href="#ref_hash" title="#">#</a> for details.</p>
	</div>
	<div class="refsection" id="id9675"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
#
rem   comments on data structures
#     are more useful than
//    comments on algorithms.
rem
          </pre>
	    <p>This program does nothing, but in a splendid and well commented way.</p>
	  </div>
	</div>
	<div class="refsection" id="id9682"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_hash" title="#">#</a></code>, <code class="function"><a class="link" href="#ref_double_slash" title="//">//</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_repeat"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  repeat
	   &#8212; start a <code class="function">repeat</code>-loop
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
repeat 
  &#8230;
until &#8230;
</pre>
	</div>
	<div class="refsection" id="id9700"><h2>Description</h2>
	  
	  <p>The <code class="function">repeat</code>-loop executes all the statements up to the final <code class="function">until</code>-keyword over and over. The loop is executed as long as the condition, which is specified with the <code class="function">until</code>-clause, becomes true. By construction, the statements within the loop are executed at least once.</p>
	</div>
	<div class="refsection" id="id9708"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
x=0
clear screen
print "This program will print the numbers from 1 to 10"
repeat
  x=x+1
  print x
  print "Press any key for the next number, or 'q' to quit"
  if (inkey$="q") break
until x=10
          </pre>
	    <p>This program is pretty much useless, but self-explanatory.</p>
	  </div>
	</div>
	<div class="refsection" id="id9715"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_until" title="until">until</a></code>, <code class="function"><a class="link" href="#ref_break" title="break">break</a></code>, <code class="function"><a class="link" href="#ref_while" title="while">while</a></code>, <code class="function"><a class="link" href="#ref_do" title="do">do</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_restore"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  restore
	   &#8212; reposition the <code class="function">data</code>-pointer
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
read a,b,c,d,e,f
restore
read g,h,i
restore foo
data 1,2,3
label foo
data 4,5,6
</pre>
	</div>
	<div class="refsection" id="id9737"><h2>Description</h2>
	  
	  <p>The <code class="function">restore</code>-command may be used to <span class="emphasis"><em>reset</em></span> the reading of <code class="function">data</code>-statements, so that the next <code class="function">read</code>-statement will read data from the first <code class="function">data</code>-statement.</p>
	  <p>You may specify a <a class="link" href="#ref_label" title="label">label</a> with the <code class="function">restore</code>-command; in that case, the next <code class="function">read</code>-statement will read data starting at the given label. If the label is omitted, reading data will begin with the first <code class="function">data</code>-statement within your program.</p>
	</div>
	<div class="refsection" id="id9752"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Which language (german/english) ? " l$
if (instr("german",l$)&gt;0) then
  restore german
else
  restore english
endif

for a=1 to 3
  read x,x$
  print x,"=",x$
next a

label english
data 1,"one",2,"two",3,"three"
label german
data 1,"eins",2,"zwei",3,"drei"
          </pre>
	    <p>This program asks to select one of those languages known to me (i.e. english or german) and then prints the numbers 1,2 and 3 and their textual equivalents in the chosen language.</p>
	  </div>
	</div>
	<div class="refsection" id="id9759"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_read" title="read">read</a></code>, <code class="function"><a class="link" href="#ref_data" title="data">data</a></code>, <code class="function"><a class="link" href="#ref_label" title="label">label</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_return"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  return
	   &#8212; return from a subroutine or a gosub
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
gosub foo
&#8230;
label foo
&#8230;
return

sub bar(baz)
  &#8230;
  return quertz
end sub
</pre>
	</div>
	<div class="refsection" id="id9778"><h2>Description</h2>
	  
	  <p>The <code class="function">return</code>-statement serves two different (albeit somewhat related) purposes. The probably more important use of <code class="function">return</code> is to return control from within a subroutine to the place in your program, where the subroutine has been called. If the subroutine is declared to return a value, the <code class="function">return</code>-statement might be accompanied by a string or number, which constitutes the <span class="emphasis"><em>return value</em></span> of the subroutine.</p>
	  <p>However, even if the subroutine should return a value, the <code class="function">return</code>-statement need not carry a value; in that case the subroutine will return 0 or the empty string (depending on the type of the subroutine). Moreover, feel free to place multiple <code class="function">return</code>-statements within your subroutine; it's a nice way of controlling the flow of execution.</p>
	  <p>The second (but historically first) use of <code class="function">return</code> is to return to the position, where a prior <code class="function"><a class="link" href="#ref_gosub" title="gosub">gosub</a></code> has left off. In that case <code class="function">return</code> may <span class="emphasis"><em>not</em></span> carry a value.</p>
	</div>
	<div class="refsection" id="id9796"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
do
  read a$
  if (a$="") then
    print
    end
  endif
  print mark$(a$)," ";
loop

data "The","quick","brown","fox","jumped"
data "over","the","lazy","dog",""

sub mark$(a$)
  if (instr(lower$(a$),"q")) return upper$(a$)
  return a$
end sub
          </pre>
	    <p>This example features a subroutine <code class="function">mark$</code>, that returns its argument in upper case, if it contains the letter "q", or unchanged otherwise. In the test-text the word <code class="literal">quick</code> will end up being marked as <code class="literal">QUICK</code>.</p>
	    <p>The example above demonstrates <code class="function">return</code> within subroutines; please see <a class="link" href="#ref_gosub" title="gosub"><code class="function">gosub</code></a> for an example of how to use <code class="function">return</code> in this context.</p>
	  </div>
	</div>
	<div class="refsection" id="id9811"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_sub" title="sub"><code class="function">sub</code></a>, <a class="link" href="#ref_gosub" title="gosub"><code class="function">gosub</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_reverse"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  reverse
	   &#8212; print reverse (background and foreground colors exchanged)
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
clear screen
&#8230;
print reverse "foo"
</pre>
	</div>
	<div class="refsection" id="id9828"><h2>Description</h2>
	  
	  <p><code class="function">reverse</code> may be used to <code class="function">print</code> text in reverse. <code class="function">reverse</code> is not a separate command, but part of the <code class="function">print</code>-command; it may be included just after the <code class="function">print</code> and can only be issued once that <code class="function">clear screen</code> has been issued.</p>
	</div>
	<div class="refsection" id="id9839"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
clear screen

print "1 ";
c=3
do
  prim=true
  for a=2 to sqrt(c)
    if (frac(c/a)=0) then
      prim=false
      break
    endif
  next a
  if (prim) then
    print
    print reverse c;
  else
    print c;
  endif
  print " ";
  c=c+1
loop
          </pre>
	    <p>This program prints numbers from 1 on and marks each prime number in reverse.</p>
	  </div>
	</div>
	<div class="refsection" id="id9846"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_at" title="at()">at</a></code><code class="function">, <code class="function"><a class="link" href="#ref_print_color" title="print or input with color">print color</a></code>, <a class="link" href="#ref_print" title="print">print</a></code>, <code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_right"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  right$()
	   &#8212; return (<span class="emphasis"><em>or change</em></span>) the right end of a string
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print right$(a$,2)
right$(b$,2)="baz"
</pre>
	</div>
	<div class="refsection" id="id9868"><h2>Description</h2>
	  
	  <p>The <code class="function">right$</code>-function requires two arguments (a string and a number) and returns the part from the right end of the string, whose length is specified by its second argument. So, <code class="function">right$</code> simply returns the requested number of chars from the right end of the given string.</p>
	  <p>Note, that the <code class="function">right$</code>-function can be assigned to, i.e. it may appear on the left hand side of an assignment. In this way it is possible to change a part of the variable used within the <code class="function">right$</code>-function. Note, that that way the <span class="emphasis"><em>length</em></span> of the string cannot be changed, i.e. characters might be overwritten, but not added. For an example see below.</p>
	</div>
	<div class="refsection" id="id9879"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "Please enter a length either in inch or centimeter"
print "please add 'in' or 'cm' to mark the unit."
input "Length: " a$
if (right$(a$,2)="in") then
   length=val(a$)*2.56
elsif (right$(a$,2)="cm") then
   length=val(a$)
else
   error "Invalid input: "+a$
endif
          </pre>
	    <p>This program allows the user to enter a length qualified with a unit (either inch or centimeter).</p>
	    <p>This second example demonstrates the capability to <span class="emphasis"><em>assign</em></span> to the <code class="function">right$</code>-function.</p>
	    <pre class="programlisting">
a$="Heiho World !"
print a$
right$(a$,7)="dwarfs."
print a$
</pre>
	  </div>
	</div>
	<div class="refsection" id="id9890"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_right" title="right$()">right$</a></code> and <code class="function"><a class="link" href="#ref_mid" title="mid$()">mid$</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_rinstr"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  rinstr()
	   &#8212; find the rightmost occurrence of one string within the other
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
pos=rinstr("Thequickbrownfox","equi")
pos=rinstr(a$,b$,x)
</pre>
	</div>
	<div class="refsection" id="id9907"><h2>Description</h2>
	  
	  <p>The <code class="function">rinstr</code>-function accepts two string-arguments and tries to find the second within the first. However, unlike the <code class="function"><a class="link" href="#ref_instr" title="instr()">instr</a></code>, the <code class="function">rinstr</code>-function finds the <span class="emphasis"><em>rightmost</em></span> (or last) occurrence of the string; whereas the <code class="function">instr</code>-function finds the <span class="emphasis"><em>leftmost</em></span> (or first) occurrence. In any case however, the position is counted from the left.</p>
	  <p>If you supply a third, numeric argument to the <code class="function">rinstr</code>-function, it will be used as a starting point for the search. Therefore <code class="function">rinstr("abcdeabcdeabcde","e",8)</code> will return 5, because the search for an "<code class="literal">e</code>" starts at position 8 and finds the first one at position 5.</p>
	</div>
	<div class="refsection" id="id9923"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print rinstr("foofoofoobar","foo")
          </pre>
	    <p>This simple example will print <code class="computeroutput">7</code>, because it finds the <span class="emphasis"><em>rightmost</em></span> among the three occurrences of <code class="literal">foo</code> within the string. Note, that</p>
	    <div class="informalexample">
	      <pre class="programlisting">
print instr("foofoofoobar","foo")
</pre> 
	    </div>
	    <p>would have printed <code class="computeroutput">1</code>.</p>
	  </div>
	</div>
	<div class="refsection" id="id9937"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_instr" title="instr()">instr</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_round"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  round()
	   &#8212; round its argument to the nearest integer
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print round(x)
</pre>
	</div>
	<div class="refsection" id="id9952"><h2>Description</h2>
	  
	  <p>The <code class="function">found</code>-function returns the nearest integer (e.g. <code class="computeroutput">3.0</code> for an argument of <code class="computeroutput">2.6</code>). An argument with a fractional part of <code class="computeroutput">0.5</code> (e.g. <code class="computeroutput">2.5</code>) represents an edge case, as such an argument has the same distance to two numbers, <code class="computeroutput">3.0</code> and <code class="computeroutput">2.0</code> in the example; this ambiguity is resolved by rounding away from zero and returning <code class="computeroutput">3.0</code>. By the same rule <code class="function">round(-2.5)</code> returns <code class="computeroutput">-3.0</code>; so you see, that <code class="literal">round(x)</code> always equals <code class="literal">round(-x)</code>.</p>
	</div>
	<div class="refsection" id="id9969"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print round(2.3), round(2.5), round(2.7)
print round(2), round(-2)
print int(-2.3),round(-2.5), round(-2.7)
          </pre>
	    <p>These examples return in order <code class="computeroutput">2 3 3</code>, then <code class="computeroutput">2 -2</code> and finally <code class="computeroutput">2 -3 -3</code>.</p>
	  </div>
	</div>
	<div class="refsection" id="id9979"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_ceil" title="ceil()">ceil</a></code>, <code class="function"><a class="link" href="#ref_floor" title="floor()">floor</a></code>, <code class="function"><a class="link" href="#ref_int" title="int()">int</a></code>, <code class="function"><a class="link" href="#ref_frac" title="frac()">frac</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_rtrim"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  rtrim$()
	   &#8212; trim spaces at the right end of a string
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
a$=rtrim$(b$)
</pre>
	</div>
	<div class="refsection" id="id10000"><h2>Description</h2>
	  
	  <p>The <code class="function">rtrim$</code>-function removes all whitespace from the right end of a string and returns the result.</p>
	</div>
	<div class="refsection" id="id10006"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open 1,"foo"
dim lines$(100)
l=1
while not eof(1)
  input #1 a$
  a$=rtrim$(a$)
  if (right$(line$,1)="\\") then
    line$=line$+" "+a$
  else
    lines$(l)=line$
    l=l+1
    line$=a$
  endif
end while
print "Read ",l," lines"
          </pre>
	    <p>This example reads the file <code class="filename">foo</code> allowing for <span class="emphasis"><em>continuation lines</em></span>, which are marked by a <code class="literal">\</code>, which appears as the last character on a line. For convenience whitespace at the right end of a line is trimmed with <code class="function">rtrim</code>.</p>
	  </div>
	</div>
	<div class="refsection" id="id10017"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_ltrim" title="ltrim$()">ltrim$</a></code>, <code class="function"><a class="link" href="#ref_trim" title="trim$()">trim$</a></code></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_s"><div class="titlepage"><div><div><h2 class="title" style="clear: both">S</h2></div></div></div>
      

      <div class="refentry" id="ref_screen"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  screen
	   &#8212; as <code class="function">clear screen</code> clears the text window
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
clear screen
</pre>
	</div>
	<div class="refsection" id="id10039"><h2>Description</h2>
	  
	  <p>The keyword <code class="function">screen</code> appears only within the sequence <code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></code>; please see there for a description.</p>
	</div>
	<div class="refsection" id="id10047"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_clear_screen" title="clear screen">clear screen</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_seek"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  seek()
	   &#8212; change the position within an open file
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
open 1,"foo"
seek #1,q
seek #1,x,"begin"
seek #1,y,"end"
seek #1,z,"here"
</pre>
	</div>
	<div class="refsection" id="id10062"><h2>Description</h2>
	  
	  <p>The <code class="function">seek</code>-command changes the position, where the next <code class="function">input</code> (or <code class="function">peek</code>) statement will read from an open file. Usually files are read from the beginning to the end sequentially; however sometimes you may want to depart from this simple scheme. This can be done with the <code class="function">seek</code>-command, allowing you to change the position, where the next piece of data will be read from the file.</p>
	  <p><code class="function">seek</code> accepts two or three arguments: The first one is the number of an already open file. The second one is the position where the next read from the file will start. The third argument is optional and specifies the the point from where the position (the second argument) will count. It can be one of:</p>
	  <div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">begin</code></span></dt><dd>
		<p>Count from the beginning of the file.</p>
	      </dd><dt><span class="term"><code class="literal">end</code></span></dt><dd>
		<p>Count from the end of the file.</p>
	      </dd><dt><span class="term"><code class="literal">here</code></span></dt><dd>
		<p>Count from the current position within the file.</p>
	      </dd></dl></div>
	</div>
	<div class="refsection" id="id10089"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open #1,"count.dat","w"
for a=1 to 10
  print #1,"00000000";
  if (a&lt;10) print #1,";";
next a

dim count(10)
do
  x=int(ran(10))
  i=i+1
  if (mod(i,1000)=0) print ".";
  count(x)=count(x)+1
  curr$=right$("00000000"+str$(count(x)),8)
  seek #1,9*x,"begin"
  print #1,curr$;
loop
          </pre>
	    <p>This example increments randomly one of ten counters (in the array <code class="literal">count()</code>); however, the result is always kept and updated within the file <code class="filename">count.dat</code>, so even in case of an unexpected interrupt, the result will not be lost.</p>
	  </div>
	</div>
	<div class="refsection" id="id10098"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_tell" title="tell">tell</a></code>, <code class="function"><a class="link" href="#ref_open" title="open">open</a></code>, <code class="function"><a class="link" href="#ref_print" title="print">print</a></code>, <code class="function"><a class="link" href="#ref_peek" title="peek">peek</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_sig"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  sig()
	   &#8212; return the sign of its argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
a=sig(b)
</pre>
	</div>
	<div class="refsection" id="id10119"><h2>Description</h2>
	  
	  <p>Return <code class="literal">+1</code>, <code class="literal">-1</code> or <code class="literal">0</code>, if the single argument is positive, negative or zero.</p>
	</div>
	<div class="refsection" id="id10127"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
clear screen
dim c$(3):c$(1)="red":c$(2)="white":c$(3)="green"
do
  num=ran(100)-50
  print color(c$(2+sig(num))) num
loop
          </pre>
	    <p>This program prints an infinite sequence of random number; positive numbers are printed in green, negative numbers are printed red (an exact zero would be printed white). (With a little extra work, this program could be easily extended into a brokerage system)</p>
	  </div>
	</div>
	<div class="refsection" id="id10134"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_abs" title="abs()">abs</a></code>, <code class="function"><a class="link" href="#ref_int" title="int()">int</a></code>, <code class="function"><a class="link" href="#ref_frac" title="frac()">frac</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_sin"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  sin()
	   &#8212; return the sine of its single argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
y=sin(angle)
</pre>
	</div>
	<div class="refsection" id="id10153"><h2>Description</h2>
	  
	  <p>The <code class="function">sin</code>-function expects an angle (in radians, <span class="emphasis"><em>not</em></span> degrees) and returns its sine.</p>
	</div>
	<div class="refsection" id="id10160"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
new curve
for phi=0 to 2*pi step 0.1
  line to 100+90*sin(phi),100+90*cos(phi)
next phi
close curve
          </pre>
	    <p>This program draws a circle (ignoring the existence of the <code class="function"><a class="link" href="#ref_circle" title="circle">circle</a></code>-command).</p>
	  </div>
	</div>
	<div class="refsection" id="id10169"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_asin" title="asin()">asin</a></code>, <code class="function"><a class="link" href="#ref_cos" title="cos()">cos</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_shl"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  shl()
	   &#8212; shift its argument bitwise to the left
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print shl(0b11001,8)	    
</pre>
	</div>
	<div class="refsection" id="id10186"><h2>Description</h2>
	  
	  <p>The <code class="function">shl</code>-function (<code class="literal">shl</code> stands for <span class="emphasis"><em>shift left</em></span>) treats its first argument as a binary number and shifts it to the left as specified by its second argument, filling up the gaps with zeroes. So <code class="literal">bin$(shl(0b11011,4))</code> returns <code class="literal">110110000</code> (the example uses <code class="function"><a class="link" href="#ref_bin" title="bin$()">bin$</a></code> and a <a class="link" href="#top_numbers_with_base_2_or_16" title="Numbers with base 2 or 16">number with base 2</a>).</p>
	  <p>Please note: as the argument of the function is converted to a 32-bit integer, all results are also confined to this range.</p>
	</div>
	<div class="refsection" id="id10200"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "Some powers of two:"
for i=0 to 5
  print shl(1,i)
next i
          </pre>
	    <p>This will print the powers of two from 1 to 32, because the left-shift operation is equivalent to a multiplication with two.</p>
	  </div>
	</div>
	<div class="refsection" id="id10207"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_bitwise_and" title="and()">and</a></code>, <a class="link" href="#ref_bitwise_or" title="or()"><code class="function">or</code></a>, <a class="link" href="#ref_eor" title="eor()"><code class="function">eor</code></a>, <a class="link" href="#ref_bitnot" title="bitnot()"><code class="function">bitnot</code></a>, <a class="link" href="#ref_shr" title="shr()"><code class="function">shr</code></a></p>
	</div>
      </div>
      
      <div class="refentry" id="ref_shr"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  shr()
	   &#8212; shift its argument bitwise to the right
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print shr(0b110010000,4)	    
</pre>
	</div>
	<div class="refsection" id="id10230"><h2>Description</h2>
	  
	  <p>The <code class="function">shr</code>-function (<code class="literal">shr</code> stands for <span class="emphasis"><em>shift right</em></span>) treats its first argument as a binary number and shifts it to the right as specified by its second argument; the rightmost binary digits are discarded during this operation. So <code class="literal">bin$(shr(0b1101100,2))</code> returns <code class="literal">11011</code> (the example uses <code class="function"><a class="link" href="#ref_bin" title="bin$()">bin$</a></code> and a <a class="link" href="#top_numbers_with_base_2_or_16" title="Numbers with base 2 or 16">number with base 2</a>).</p>
	  <p>Please note: as the argument of the function is converted to a 32-bit integer, all results are also confined to this range.</p>
	</div>
	<div class="refsection" id="id10244"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "Some powers of two:"
for i=0 to 5
  print shr(32,i)
next i
          </pre>
	    <p>This will print the powers of two from 32 downto 1, because the right-shift operation is equivalent to a division by two (discarding any fractional part).</p>
	  </div>
	</div>
	<div class="refsection" id="id10251"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_bitwise_and" title="and()">and</a></code>, <a class="link" href="#ref_bitwise_or" title="or()"><code class="function">or</code></a>, <a class="link" href="#ref_eor" title="eor()"><code class="function">eor</code></a>, <a class="link" href="#ref_bitnot" title="bitnot()"><code class="function">bitnot</code></a>, <a class="link" href="#ref_shl" title="shl()"><code class="function">shl</code></a></p>
	</div>
      </div>
      
      <div class="refentry" id="ref_sleep"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  sleep
	   &#8212; pause, sleep, wait for the specified number of seconds
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
sleep 4
</pre>
	</div>
	<div class="refsection" id="id10274"><h2>Description</h2>
	  
	  <p>The <code class="function">sleep</code>-command has many different names: You may write <code class="function">pause</code>, <code class="function">sleep</code> or <code class="function">wait</code> interchangeably; whatever you write, <span class="application">yabasic</span> will always do exactly the same.</p>
	  <p>Therefore you should refer to the entry for the <code class="function"><a class="link" href="#ref_pause" title="pause">pause</a></code>-function for further information.</p>
	</div>
      </div>

      <div class="refentry" id="ref_split"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  split()
	   &#8212; split a string into many strings
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
dim w$(10)
&#8230;
num=split(a$,w$())
num=split(a$,w$(),s$)
</pre>
	</div>
	<div class="refsection" id="id10295"><h2>Description</h2>
	  
	  <p>The <code class="function">split</code>-function requires a string (containing the text to be split), a <a class="link" href="#ref_array_references" title="References on arrays">reference</a> to a string-array (which will receive the resulting strings, i.e. the <span class="emphasis"><em>tokens</em></span>) and an optional string (with a set of characters, at which to split, i.e. the <span class="emphasis"><em>delimiters</em></span>).</p>
	  <p>The <code class="function">split</code>-function regards its first argument (a string) as a list of <span class="emphasis"><em>tokens</em></span> separated by <span class="emphasis"><em>delimiters</em></span> and it will store the list of tokens within the array-reference you have supplied. Note, that the array, which is passed as a reference (<code class="literal">w$()</code> in the synopsis), will be resized accordingly, so that you don't have to figure out the number of tokens in advance. The element at position zero (i.e. <code class="literal">w$(0)</code>) will not be used.</p>

	  <p>normally (i.e. if you omit the third, which is the delimiter-argument) the function will regard <span class="emphasis"><em>space</em></span> or <span class="emphasis"><em>tab</em></span> as delimiters for tokens; however by supplying a third argument, you may split at <span class="emphasis"><em>any single</em></span> of the characters within this string. E.g. if you supply <code class="literal">":;"</code> as the third argument, then colon (<code class="literal">:</code>) or semicolon (<code class="literal">;</code>) will delimit tokens.</p>
	  <p>Note, that a sequence of separator-characters will produce a sequence of empty tokens; that way, the number of tokens returned will always be one plus the number of separator characters contained within the string. Refer to the closely related <code class="function"><a class="link" href="#ref_token" title="token()">token</a></code>-function, if you do not like this behaviour. In some way, the <code class="function">split</code>-function focuses on the separators (other than the <code class="function">token</code>-function, which focuses on the <span class="emphasis"><em>tokens</em></span>), hence its name.</p>
	  <p>The second argument is a <a class="link" href="#ref_array_references" title="References on arrays">reference</a> on a string-array, where the tokens will be stored; this array will be expanded (or shrunk) to have room for all tokens, if necessary.</p>
	  <p>The first argument finally contains the text, that will be split into tokens. The <code class="function">split</code>-function returns the number of tokens that have been found.</p>
	  <p>Please see the examples below for some hints on the exact behaviour of the <code class="function">split</code>-function and how it differs from the <code class="function">token</code>-function:</p>
	</div>
	<div class="refsection" id="id10330"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "This program will help you to understand, how the"
print "split()-function exactly works and how it behaves"
print "in certain special cases."
print
print "Please enter a line containing tokens separated"
print "by either '=' or '-'"
dim t$(10)
do
  print 
  input "Please enter a line: " l$
  num=split(l$,t$(),"=-")
  print num," Tokens: ";
  for a=1 to num
    if (t$(a)="") then
      print "(EMPTY)";
    else 
      print t$(a);
    endif
    if (a&lt;num) print ","; 
  next a
  print
loop
          </pre>
	    <p>This program prints the following output:</p>
	    <p>
</p><pre class="screen">
Please enter a line: a
1 Tokens: a

Please enter a line:
0 Tokens:

Please enter a line: ab
1 Tokens: ab

Please enter a line: a=b
2 Tokens: a,b

Please enter a line: a-
2 Tokens: a,(EMPTY)

Please enter a line: a-=
3 Tokens: a,(EMPTY),(EMPTY)

Please enter a line: =a-
3 Tokens: (EMPTY),a,(EMPTY)

Please enter a line: a=-b
3 Tokens: a,(EMPTY),b

Please enter a line: a--b-
4 Tokens: a,(EMPTY),b,(EMPTY)

Please enter a line: -a==b-c==
7 Tokens: (EMPTY),a,(EMPTY),b,c,(EMPTY),(EMPTY)
</pre><p>
</p>
	  </div>
	</div>
	<div class="refsection" id="id10339"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_token" title="token()">token</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_sqr"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  sqr()
	   &#8212; compute the square of its argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
a=sqr(b)
</pre>
	</div>
	<div class="refsection" id="id10354"><h2>Description</h2>
	  
	  <p>The <code class="function">sqr</code>-function computes the square of its numerical argument (i.e. it multiplies its argument with itself).</p>
	  <p>Please note, that other dialects of <abbr class="acronym">basic</abbr> use <code class="function">sqr</code> as the <span class="emphasis"><em>square root</em></span>, rather than the <span class="emphasis"><em>square</em></span>; this needs to be checked especially when porting programs from other Versions of <abbr class="acronym">basic</abbr>.</p>
	</div>
	<div class="refsection" id="id10366"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=1 to 10
  print a,sqr(a),a**2
next a
          </pre>
	    <p>As you may see from the output, <code class="function">sqr</code> can be written as <code class="function">**2</code> (or <code class="function">^2</code>) too.</p>
	  </div>
	</div>
	<div class="refsection" id="id10376"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_sqrt" title="sqrt()">sqrt</a></code>, <code class="function"><a class="link" href="#ref_pow" title="** or ^">**</a></code>, <code class="function"><a class="link" href="#ref_pow" title="** or ^">^</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_sqrt"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  sqrt()
	   &#8212; compute the square root of its argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">to be written</pre>
	</div>
	<div class="refsection" id="id10395"><h2>Description</h2>
	  
	  <p>The <code class="function">sqrt</code>-function computes the square root of its numerical argument.</p>
	</div>
	<div class="refsection" id="id10401"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=1 to 5
  print a,sqrt(a),a**(1/2)
next a
          </pre>
	    <p>As you may see from the output, <code class="function">sqrt</code> can be written as <code class="function">**(1/2)</code> (or <code class="function">^(1/2)</code>) too.</p>
	  </div>
	</div>
	<div class="refsection" id="id10411"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_sqr" title="sqr()">sqr</a></code>, <code class="function"><a class="link" href="#ref_pow" title="** or ^">**</a></code>, <code class="function"><a class="link" href="#ref_pow" title="** or ^">^</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_static"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  static
	   &#8212; preserves the value of a variable between calls to a subroutine
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
sub foo()

  static a

  &#8230;

end sub 
</pre>
	</div>
	<div class="refsection" id="id10430"><h2>Description</h2>
	  
	  <p>The <code class="function">static</code> keyword can be used within subroutines to mark variables as <span class="emphasis"><em>static</em></span>. This has two effects: First, the variable is <span class="emphasis"><em>local</em></span> to the subroutine, i.e. its value is not know outside the subroutine (this is the effect of the <code class="function"><a class="link" href="#ref_local" title="local">local</a></code> keyword). Second, the <code class="function">static</code>-keyword arranges things, so that the variable keeps its value between invocations of the subroutine (this is different from the <code class="function">local</code>-keyword).</p>
	</div>
	<div class="refsection" id="id10442"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
foo()
foo()
foo()

sub foo()
  static a
  local b
  a=a+1
  b=b+1
  print a,b
end sub
          </pre>
	    <p>This program shows the difference between <code class="function">static</code> and <code class="function">local</code> variables within a subroutine; it produces this output:</p>
	    <p>
</p><pre class="screen">1 1
2 1
3 1
</pre><p>
</p>
	    <p>The output shows, that the <code class="function">static</code> variable <code class="varname">a</code> keeps its value between subroutine calls, whereas <code class="varname">b</code> is initialized with the value 0 at every call to the subroutine <code class="function">foo</code>.</p>
	  </div>
	</div>
	<div class="refsection" id="id10458"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_sub" title="sub">sub</a></code>, <code class="function"><a class="link" href="#ref_local" title="local">local</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_step"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  step
	   &#8212; specifies the increment step in a for-loop
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
for a=1 to 10 step 3
  &#8230;
next a
</pre>
	</div>
	<div class="refsection" id="id10475"><h2>Description</h2>
	  
	  <p>Specify, by which amount the loop-variable of a <code class="function"><a class="link" href="#ref_for" title="for">for</a></code>-loop will be incremented at each step.</p>
	  <p>The <code class="function">step</code> (as well as the lower and upper bound) are computed anew in each step; this is not common, but possible, as the example below demonstrates.</p>
	</div>
	<div class="refsection" id="id10484"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for x=1 to 1000 step y
  y=x+y
  print x," ",y," ";
next x
print
          </pre>
	    <p>This program computes the fibonacci numbers between 1 and 1000.</p>
	  </div>
	</div>
	<div class="refsection" id="id10491"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_for" title="for">for</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_str"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  str$()
	   &#8212; convert a number into a string
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
a$=str$(a)	    
b$=str$(x,"##.###")
b$=str$(x,"###,###.##","_.")
c$=str$(x,"%g")
</pre>
	</div>
	<div class="refsection" id="id10506"><h2>Description</h2>
	  
	  <p>The <code class="function">str$</code>-function accepts a numeric argument and returns it as a string.</p>
	  <p>Note: As a special and trivial case <code class="function">str$</code> also accepts a single string-argument, which it just returns unchanged; this can be useful e.g. when used with <code class="function"><a class="link" href="#ref_eval2" title="eval$()">eval$</a></code>, see the example there for an application.</p>
	  <p>Please note, that this function is not related with the similar named function <code class="function"><a class="link" href="#ref_string" title="string$()">string$</a></code>.</p>	  
	  <p>For the common case of converting a number to a string, the process can be controlled with an optional third argument (the <span class="emphasis"><em>format</em></span> argument). See the following table of examples to learn about valid values of this argument. Note, that those examples fall in one of two categories: <span class="emphasis"><em>C-style</em></span> and <span class="emphasis"><em>basic-style</em></span>; the first 4 examples in the table below are C-style, the rest of the examples are basic-style. For more information on the C-style formats, you may refer to your favorite documentation on the <span class="application">C</span> programming language. The basic-style formats are much simpler, they just depict the desired output, marking digits with '<code class="literal">#</code>'; groups of (usually three) digits may be separated with colons ('<code class="literal">,</code>'), the decimal dot must be marked by a literal dot ('<code class="literal">.</code>'). Moreover these characters (colons and dot) may be replaced by other characters to satisfy the needs of non-english (e.g. german) languages; see the examples below.</p>
	  <p>Note, that for clarity, each space in the result has been replaced by the letter 'x', because it would be hard to figure out, how many spaces are produced <span class="emphasis"><em>exactly</em></span> otherwise.</p>
	  <div class="table" id="id10529"><div class="table-title">Table&#160;7.2.&#160;Examples for the format argument</div><div class="table-contents">
	    
	    <table style="border-collapse: collapse; border-top: 1px solid ; border-bottom: 1px solid ; border-left: 1px solid ; border-right: 1px solid ; "><colgroup><col/><col/></colgroup><thead><tr><th style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="function">Example string</code></th><th style="border-bottom: 1px solid ; "><code class="function">Result for converting 1000*<code class="constant">pi</code></code></th><th style="border-bottom: 1px solid ; "><code class="function">Description</code></th></tr></thead><tbody><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="literal">%g</code></td><td style="border-bottom: 1px solid ; "><code class="literal">3141.59</code></td><td style="border-bottom: 1px solid ; ">Internally <span class="application">yabasic</span> uses double precision, so its numbers can be formatted with the <code class="literal">%g</code> format specifier.</td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="literal">%2.5f</code></td><td style="border-bottom: 1px solid ; "><code class="literal">3141.59265</code></td><td style="border-bottom: 1px solid ; ">The '<code class="literal">2</code>' determines the minimum length of the output; but if needed (as in the example) the output can be longer. The '<code class="literal">5</code>' is the number of digits after the decimal point.</td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="literal">%12.5f</code></td><td style="border-bottom: 1px solid ; "><code class="literal">xx3141.59265</code></td><td style="border-bottom: 1px solid ; ">Two spaces (which appear as '<code class="literal">x</code>') are added to pad the output to the requested length of 12 characters.</td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="literal">%012.5g</code></td><td style="border-bottom: 1px solid ; "><code class="literal">0000003141.6</code></td><td style="border-bottom: 1px solid ; ">The '<code class="literal">g</code>' requests, that the precision ('<code class="literal">5</code>') specifies the <span class="emphasis"><em>overall</em></span> number of digits (before and after the decimal point).</td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="literal">%-12.5f</code></td><td style="border-bottom: 1px solid ; "><code class="literal">3141.59265xx</code></td><td style="border-bottom: 1px solid ; ">The '<code class="literal">-</code>' requests the output to be left-centered (therefore the filling space appears at the right).</td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="literal">#####.##</code></td><td style="border-bottom: 1px solid ; "><code class="literal">x3141.59</code></td><td style="border-bottom: 1px solid ; ">Each '<code class="literal">#</code>' specifies a digit (either before or after the dot), the '<code class="literal">.</code>' specifies the position of the dot. As 1000*<code class="constant">pi</code> does not have enough digits, the 5 requested digits before the dot are filled up with a space (which shows up as an '<code class="literal">x</code>').</td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="literal">##,###.##</code></td><td style="border-bottom: 1px solid ; "><code class="literal">x3,141.59</code></td><td style="border-bottom: 1px solid ; ">Nearly the same as above, but the colon from the format shows up within the result.</td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="literal">##,###.##</code> and an <span class="emphasis"><em>additional</em></span> argument of <code class="literal">".,"</code></td><td style="border-bottom: 1px solid ; "><code class="literal">x3.141,59</code></td><td style="border-bottom: 1px solid ; ">Similar to the example above, but colon and dot are replaced with dot and colon respectively.</td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="literal">##,###.##</code> and an <span class="emphasis"><em>additional</em></span> argument of <code class="literal">"_,"</code></td><td style="border-bottom: 1px solid ; "><code class="literal">x3_141,59</code></td><td style="border-bottom: 1px solid ; ">Similar to the example above, but colon and dot are replaced with underscore and colon respectively.</td></tr><tr><td style="border-right: 1px solid ; border-bottom: 1px solid ; "><code class="literal">#####</code></td><td style="border-bottom: 1px solid ; "><code class="literal">x3142</code></td><td style="border-bottom: 1px solid ; ">The format string does not contain a dot, and therefore the result does not have any fractional digits.</td></tr><tr><td style="border-right: 1px solid ; "><code class="literal">##.###</code></td><td><code class="literal">##.###</code></td><td>As 1000*<code class="constant">pi</code> has 4 digits in front of the decimal dot and the format only specifies 2, <span class="application">yabasic</span> does not know what to do; therefore it chooses just to reproduce the format string.</td></tr></tbody></table>
	  </div></div><br class="table-break"/>
	</div>
	<div class="refsection" id="id10629"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
do
  input "Please enter a format string: " f$
  a$=str$(1000*pi,f$)
  for a=1 to len(a$)
    if (mid$(a$,a,1)=" ") mid$(a$,a,1)="x"
  next a
  print a$
loop
          </pre>
	    <p>This is the program, that has been used to get the results shown in the table above.</p>
	  </div>
	</div>
	<div class="refsection" id="id10636"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_print" title="print">print</a></code>, <code class="function"><a class="link" href="#ref_using" title="using">using</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_string"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  string$()
	   &#8212; create a new string by repeating the given one a certain number of times
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print string$(21,"-")	    
print string$(10,"-=")+"-"
          </pre>
	</div>
	<div class="refsection" id="id10653"><h2>Description</h2>
	  
	  <p>The <code class="function">string$</code>-function takes a numeric and a string argument and and returns a new string that repeats the given string the given number of times.</p>
	  <p>Please note, that this function is not related with the similar named function <code class="function"><a class="link" href="#ref_str" title="str$()">str$</a></code>.</p>
	  <p>The function <code class="function">string$</code> can be useful e.g. to build progress-bars. It can also help in formatting text e.g. two separate sections of text or to underline headings; see the example below. <code class="function">string$</code> helps you to write shorter code, where otherwise a <code class="function">for</code>-loop might be needed.</p>
	</div>
	<div class="refsection" id="id10666"><h2>Example</h2>
	  <p>The example below uses <code class="function">string$</code> to structure text, either with horizontal lines or with underlined headings.</p>
	  <div class="informalexample">
	    <pre class="programlisting">
heading(1, "section")
print "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
heading(2, "subsection")
print "Sed porttitor consequat pellentesque."
print
print string$(10," ") + string$(20,"~")
print
print "Etiam est leo, dictum id pharetra feugiat, volutpat id turpis."
print

sub heading(level, text$)
  if (level = 1) then
    print
    print
    print upper$(text$)
    print string$(len(text$),"=")
    print
  else
    print
    print text$
    print string$(len(text$),"-")
    print    
  endif
end sub
            </pre>
	  <p>Its output is this:</p>
	  <pre class="screen">


SECTION
=======

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

subsection
----------

Sed porttitor consequat pellentesque.

          ~~~~~~~~~~~~~~~~~~~~

Etiam est leo, dictum id pharetra feugiat, volutpat id turpis.

</pre>

	    <p>Note, that also multi-character strings can be multiplied like this.</p>
	  </div>
	</div>
	<div class="refsection" id="id10677"><h2>See also</h2>

	  <p>Unrelated but with a similar name: <a class="link" href="#ref_str" title="str$()"><code class="function">str$</code></a></p>
	</div>
      </div>

      <div class="refentry" id="ref_sub"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  sub
	   &#8212; declare a user defined subroutine
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
foo(2,"hello")

&#8230;

sub foo(bar,baz$)
  &#8230;
  return qux
  &#8230;
end sub
</pre>
	</div>
	<div class="refsection" id="id10692"><h2>Description</h2>
	  
	  <p>The <code class="function">sub</code>-keyword starts the definition of a <span class="emphasis"><em>user defined subroutine</em></span>. With user defined subroutines you are able to somewhat extend <span class="application">yabasic</span> with your own commands or functions. A subroutine accepts arguments (numbers or strings) and returns a number or a string (however, you are not required to assign the value returned to a variable).</p>
	  <p>The name of the subroutine follows after the keyword <code class="function">sub</code>. If the name (in the synopsis: <code class="function">foo</code>) ends on a '<code class="literal">$</code>', the subroutine should return a string (with the <code class="function"><a class="link" href="#ref_return" title="return">return</a></code>-statement), otherwise a number.</p>
	  <p>After the name of the subroutine
<span class="application">yabasic</span> requires a pair of braces; within those
braces you may specify a list of parameters, for which values can (but need
not) be included when calling the subroutine. If you omit one of those
parameters when calling such a subroutine, it assumes the value zero (for
numeric parameters) or the empty string (for string-parameters). However from
the special variable <code class="varname"><a class="link" href="#ref_numparams" title="numparams">numparams</a></code> you may find out, how many arguments have really been passed when calling the subroutine.</p>
	  <p>Parameters of a subroutine are always local variables (see the keyword <code class="function"><a class="link" href="#ref_local" title="local">local</a></code> for more explanation).</p>
	  <p>From within the subroutine you may return any time with the keyword <code class="function"><a class="link" href="#ref_return" title="return">return</a></code>; along with the <code class="function">return</code>-keyword you may specify the return value. Note that more than one <code class="function">return</code> is allowed within a single subroutine.</p>
	  <p>Finally, the keyword <code class="function">end sub</code> ends the subroutine definition. Note, that the definition of a subroutine <span class="emphasis"><em>need not</em></span> appear within the program <span class="emphasis"><em>before</em></span> the first call to this sub.</p>
	  <div class="note"><h3 class="title">Note</h3>
	    <p>As <span class="emphasis"><em>braces</em></span> have two uses in <span class="application">yabasic</span> (i.e. for supplying arguments to a subroutine as well as to list the indices of an array). <span class="application">yabasic</span> can not tell apart an array from a subroutine with the same name. Therefore you <span class="emphasis"><em>cannot</em></span> define a subroutine with the same name as an array !</p>
	  </div>
	</div>
	<div class="refsection" id="id10728"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
p=2
do 
  if (is_prime(p)) print p
  p=p+1
loop

sub is_prime(a)
  local b
  for b=2 to sqrt(a)
    if (frac(a/b)=0) return false
  next b
  return true
end sub
          </pre>
	    <p>This example is not the recommended way to compute prime numbers. However it gives a nice demonstration of using a subroutine.</p>
	  </div>
	</div>
	<div class="refsection" id="id10735"><h2>See also</h2>
	  
	  <p><a class="link" href="#ref_subroutines" title="Subroutines: Sharing code within one program">subroutines</a>, <code class="function"><a class="link" href="#ref_local" title="local">local</a></code>, <code class="function"><a class="link" href="#ref_static" title="static">static</a></code>, <code class="function"><a class="link" href="#ref_peek" title="peek">peek</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_switch"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  switch
	   &#8212; select one of many alternatives depending on a value
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
switch a
  case 1
  case 2
  &#8230;
end switch

&#8230;

switch a$
  case "a"
  case "b"
end switch
</pre>
	</div>
	<div class="refsection" id="id10755"><h2>Description</h2>
	  
	  <p>The <code class="function">switch</code>-statement selects one of many codepaths depending on a numerical or string expression. I.e. it takes an expression (either numeric or string) and compares it with a series of values, each wrapped within a <code class="function"><a class="link" href="#ref_case" title="case">case</a></code>-clause. If the expression equals the value given in a <code class="function">case</code>-clause, the subsequent statements are executed.</p>
	  <p>The <code class="function"><a class="link" href="#ref_default" title="default">default</a></code>-clause allows one to specify commands, which should be executed, if none of <code class="function">case</code>-clauses matches.</p> 
	  <p>Note, that many <code class="function">case</code>-clauses might be clustered (e.g. <code class="literal">case "a":case "b":case "c"</code>). Or put another way: You need a <code class="function">break</code>-statement at the end of a <code class="function">case</code>-branch, if you do not want to run into the next <code class="function">case</code>.</p>
	</div>
	<div class="refsection" id="id10774"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a single digit: " n
switch n
  case 0:print "zero":break
  case 1:print "one":break
  case 2:print "two":break
  case 3:print "three":break
  case 4:print "four":break
  case 5:case 6: case 7:case 8:case 9
    print "Much !":break
  default:print "Hey ! That was more than a single digit !"
end switch 
          </pre>
	    <p>This example translates a single digit into a string; note, how the cases 5 to 7 are clustered.</p>
	  </div>
	</div>
	<div class="refsection" id="id10781"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_switch" title="switch">switch</a></code>, <code class="function"><a class="link" href="#ref_case" title="case">case</a></code>, <code class="function"><a class="link" href="#ref_break" title="break">break</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_system"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  system()
	   &#8212; hand the name of an external command over to your operating system and return its exitcode
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
ret=system("foo")
system("bar")
</pre>
	</div>
	<div class="refsection" id="id10800"><h2>Description</h2>
	  
	  <p>The <code class="function">system</code>-command accepts a single string argument, which specifies a command to be executed. The function will return the exitcode of the command; its output (if any) will be lost.</p>
	</div>
	<div class="refsection" id="id10806"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "Please enter the name of the file, that should be deleted."
input f$
if (system("rm "+f$+" &gt;/dev/null 2&gt;&amp;1")) then
  print "Error !"
else
  print "okay."
endif
          </pre>
	    <p>This program is Unix-specific: It uses the Unix-command <code class="function">rm</code> to remove a file.</p>
	  </div>
	</div>
	<div class="refsection" id="id10814"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_system2" title="system$()">system$</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_system2"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  system$()
	   &#8212; hand the name of an external command over to your operating system and return its output
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print system$("dir")
</pre>
	</div>
	<div class="refsection" id="id10829"><h2>Description</h2>
	  
	  <p>The <code class="function">system$</code>-command accepts a single string argument, specifying a command, that can be found and executed by your operating system. It returns the output of this command as one big string.</p>
	</div>
	<div class="refsection" id="id10835"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter the name of a directory: " d$
print
print "This is the contents of the '"+d$+"':"
print system$("dir "+d$)
          </pre>
	    <p>This example lists the contents of a directory, employing the <span class="application">dir</span>-command  (which is about the only program, that is known under Unix as well as Windows).</p>
	  </div>
	</div>
	<div class="refsection" id="id10843"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_system" title="system()">system</a></code>, <code class="function"><a class="link" href="#ref_chomp" title="chomp$()">chomp</a></code></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_t"><div class="titlepage"><div><div><h2 class="title" style="clear: both">T</h2></div></div></div>
      

      <div class="refentry" id="ref_tan"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  tan()
	   &#8212; return the tangent of its argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
foo=tan(bar)
</pre>
	</div>
	<div class="refsection" id="id10864"><h2>Description</h2>
	  
	  <p>The <code class="function">tan</code>-function computes the tangent of its arguments (which should be specified in radians).</p>
	</div>
	<div class="refsection" id="id10870"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=0 to 45
  print tan(a*pi/180)
next a
          </pre>
	    <p>This example simply prints the tangent of all angles between 0 and 45 degrees.</p>
	  </div>
	</div>
	<div class="refsection" id="id10877"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_atan" title="atan()">atan</a></code>, <code class="function"><a class="link" href="#ref_sin" title="sin()">sin</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_tell"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  tell
	   &#8212; get the current position within an open file
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
open #1,"foo"
  &#8230;
position=tell(#1)
</pre>
	</div>
	<div class="refsection" id="id10894"><h2>Description</h2>
	  
	  <p>The <code class="function">tell</code>-function requires the number of an open file as an argument. It returns the position (counted in bytes, starting from the beginning of the file) where the next read will start.</p>
	</div>
	<div class="refsection" id="id10900"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open #1,"foo","w"
print #1 "Hello World !"
close #1

open #1,"foo"
seek #1,0,"end"
print tell(#1)
close 1
          </pre>
	    <p>This example (mis)uses <code class="function">tell</code> to get the size of the file. The <code class="function">seek</code> positions the file pointer at the end of the file, therefore the call to <code class="function">tell</code> returns the total length of the file.</p>
	  </div>
	</div>
	<div class="refsection" id="id10910"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_tell" title="tell">tell</a></code>, <code class="function"><a class="link" href="#ref_open" title="open">open</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_text"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  text
	   &#8212; write text into your graphic-window
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
text x,y,"foo"
text x,y,"foo","lb"
text x,y,"foo","cc","font"
text x,y,"foo","font","rt"
</pre>
	</div>
	<div class="refsection" id="id10927"><h2>Description</h2>
	  
	  <p>The <code class="function">text</code>-commands displays a text-string (the third argument) at the given position (the first two arguments) within an already <code class="function"><a class="link" href="#ref_open_window" title="open window">open</a></code>ed <code class="function"><a class="link" href="#ref_open_window" title="open window">window</a></code>. The font to be used can be optionally specified as either the fourth or fifth argument (<code class="literal">"font"</code> in the example above). A font specified this way will also be used for any subsequent <code class="function">text</code>-commands, as long as they do not specify a font themselves.</p>
	  <p>The fourth or fifth optional argument (<code class="literal">"lb"</code> in the example above) can be used to specify the alignment of the text with respect to the specified position. This argument is always two characters long: The first character specifies the horizontal alignment and can be either <code class="literal">l</code>, <code class="literal">r</code> or <code class="literal">c</code>, which stand for <em class="wordasword">left</em>, <em class="wordasword">right</em> or <em class="wordasword">center</em>. The second character specifies the vertical alignment and can be one of <code class="literal">t</code>, <code class="literal">b</code> or <code class="literal">c</code>, which stand for <em class="wordasword">top</em>, <em class="wordasword">bottom</em> or <em class="wordasword">center</em> respectively. If you omit this alignment argument, the default <code class="literal">"lb"</code> applies; however this default may be changed with <code class="function"><a class="link" href="#ref_poke" title="poke">poke "textalign","xx"</a></code></p>
	</div>
	<div class="refsection" id="id10956"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 500,200
clear screen
data "lt","lc","lb","ct","cc","cb","rt","rc","rb"
for a=1 to 9
  read align$	
  print "Alignment: ",align$
  line 50*a-15,100,50*a+15,100
  line 50*a,85,50*a,115
  text 50*a,100,"Test",align$
  inkey$ 
next a
          </pre>
	    <p>This program draws nine crosses and writes the same text at each; however it goes through all possible nine alignment strings, showing their effect.</p>
	  </div>
	</div>
	<div class="refsection" id="id10963"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_open_window" title="open window">open window</a></code>, <code class="function"><a class="link" href="#ref_peek" title="peek">peek</a></code>, <code class="function"><a class="link" href="#ref_poke" title="poke">poke</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_then"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  then
	   &#8212; tell the long from the short form of the <code class="function">if</code>-statement
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
if (a&lt;b) then
  &#8230;
endif
</pre>
	</div>
	<div class="refsection" id="id10983"><h2>Description</h2>
	  
	  <p>The keyword <code class="function">then</code> is part of the <code class="function"><a class="link" href="#ref_if" title="if">if</a></code>-statement; please see there for further explanations. However, not every <code class="function">if</code>-statement requires the keyword <code class="function">then</code>: If the keyword <code class="function">then</code> is present, the <code class="function">if</code>-clause may extend over more than one line, and the keyword <code class="function">endif</code> is required to end it. If the keyword <code class="function">then</code> is <span class="emphasis"><em>not</em></span> present, the <code class="function">if</code>-statement extends up to the end of the line, and any <code class="function">endif</code> would be an error.</p>
	</div>
	<div class="refsection" id="id11000"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
if (1&lt;2) then 
  print "Hello ";
endif

if (2&lt;3) print "world"
if (2&lt;1)
  print "!"
          </pre>
	    <p>This example prints <code class="literal">Hello world</code>. Note, that no exclamation mark (<code class="literal">!</code>) is printed, which might come as a surprise and may be changed in future versions of <span class="application">yabasic</span>.</p>
	  </div>
	</div>
	<div class="refsection" id="id11010"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_if" title="if">if</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_time"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  time$
	   &#8212; return a string containing the current time
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print time$
print time$()
</pre>
	</div>
	<div class="refsection" id="id11025"><h2>Description</h2>
	  
	  <p>The <code class="function">time$</code> function returns the current time in four fields separated by hyphens '<code class="literal">-</code>'. The fields are:</p>
	  <p>
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
		<p>The current hour in the range from 0 to 23, padded with zeroes (e.g. <code class="literal">00</code> or <code class="literal">04</code>) to a length of two characters.</p>
	      </li><li class="listitem">
		<p>The number of minutes, padded with zeroes.</p>
	      </li><li class="listitem">
		<p>The number of seconds, padded with zeroes.</p>
	      </li><li class="listitem">
		<p>The number of seconds, that have elapsed since the program has been started. This value increases as long as your program runs and is therefore unbound and not padded with zeroes.</p>
	      </li></ul></div><p>
</p>
	  <p>At the time of writing this documentation, <code class="function">time$</code> returns <code class="computeroutput">22-58-53-0</code>. Note, that the first three of the four fields returned by <code class="function">time$</code> have a fixed width; therefore it is easy to extract some fields with the usual string-functions <code class="function"><a class="link" href="#ref_mid" title="mid$()">mid$</a></code> (and others).</p>
	</div>
	<div class="refsection" id="id11050"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "Hello it is ",time$
print "An empty for-loop with ten million iterations takes ";
for a=1 to 10000000:next a
print "Now it is ",time$
print peek("secondsrunning")," seconds have passed."
          </pre>
	    <p>This program benchmarks the <code class="function">for</code>-loop; however, it does not use the fourth field of the string returned by <code class="function">time$</code>, because that string wraps around every 60 seconds; rather the <a class="link" href="#ref_peek" title="peek"><code class="function">peek</code></a> <code class="literal">"secondsrunning"</code> is queried.</p>
	  </div>
	</div>
	<div class="refsection" id="id11062"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_date" title="date$">date</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_to"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  to
	   &#8212; this keyword appears as part of other statements
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
for a=1 to 100 step 2
  &#8230;
next a

line x,y to a,b
</pre>
	</div>
	<div class="refsection" id="id11077"><h2>Description</h2>
	  
	  <p>The <code class="function">to</code>-keyword serves two purposes (which are not related at all):</p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>within <code class="function"><a class="link" href="#ref_for" title="for">for</a></code>-statements, to specify the upper bound of the loop.</p>
	    </li><li class="listitem">
	      <p>Within any graphical command (e.g. <code class="function">line</code>), that requires two points (i.e. four numbers) as arguments, a comma '<code class="literal">,</code>' might be replaced with the keyword <code class="literal">to</code>. I.e. instead of <code class="literal">100,100,200,200</code> you may write <code class="literal">100,100 to 200,200</code> in such commands.</p>
	    </li></ul></div>
	</div>
	<div class="refsection" id="id11095"><h2>Example</h2>
	  
	  <p>Please see the command listed under "See also" for examples.</p>
	</div>
	<div class="refsection" id="id11100"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_for" title="for">for</a></code>, <code class="function"><a class="link" href="#ref_line" title="line">line</a></code>, <code class="function"><a class="link" href="#ref_rectangle" title="rectangle">rectangle</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_token"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  token()
	   &#8212; split a string into multiple strings
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
dim w$(10)
&#8230;
num=token(a$,w$())
num=token(a$,w$(),s$)
</pre>
	</div>
	<div class="refsection" id="id11119"><h2>Description</h2>
	  
	  <p>The <code class="function">token</code>-function accepts a string (containing the text to be split), a <a class="link" href="#ref_array_references" title="References on arrays">reference</a> to a string-array (which will receive the resulting strings, i.e. the <span class="emphasis"><em>tokens</em></span>) and an optional string (with a set of characters, at which to split, i.e. the <span class="emphasis"><em>delimiters</em></span>).</p>
	  <p>The <code class="function">token</code>-function regards its first argument as a list of <span class="emphasis"><em>tokens</em></span> separated by <span class="emphasis"><em>delimiters</em></span> and it will store the list of tokens within the array-reference that has been supplied. Note, that the array, which is passed as a reference (<code class="literal">w$()</code> in the synopsis), will be resized accordingly, so that you don't have to figure out the number of tokens in advance. The element at position zero (i.e. <code class="literal">w$(0)</code>) will not be used.</p>
	  <p>Normally (i.e. if you omit the third, the delimiter-argument) the function will regard <span class="emphasis"><em>space</em></span> or <span class="emphasis"><em>tab</em></span> as delimiters for tokens; however by supplying a third argument, you may split at <span class="emphasis"><em>any single</em></span> of the characters within this string. E.g. if you supply <code class="literal">":;"</code> as the third argument, then colon (<code class="literal">:</code>) or semicolon (<code class="literal">;</code>) will delimit tokens.</p>
	  <p>Note, that <code class="function">token</code> will never produce empty tokens, even if two or more separators follow in sequence. Refer to the closely related <code class="function"><a class="link" href="#ref_token" title="token()">split</a></code>-function, if you do not like this behaviour. In some way, the <code class="function">token</code>-function focuses on the tokens and not on the separators (other than the <code class="function">split</code>-function, which focuses on the separators).</p>
	  <p>The second argument is a <a class="link" href="#ref_array_references" title="References on arrays">reference</a> on a string-array, where the tokens will be stored; this array will be expanded (or shrunk) as necessary to have room for all tokens.</p>
	  <p>The first argument finally contains the text, that will be split into tokens. The <code class="function">token</code>-function returns the number of tokens, that have been found.</p>
	  <p>Please see the examples below for some hints on the exact behaviour of the <code class="function">token</code>-function and how it differs from the <code class="function">split</code>-function:</p>
	</div>
	<div class="refsection" id="id11154"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "This program will help you to understand, how the"
print "token()-function exactly works and how it behaves"
print "in certain special cases."
print
print "Please enter a line containing tokens separated"
print "by either '=' or '-'"
dim t$(10)
do
  print 
  input "Please enter a line: " l$
  num=token(l$,t$(),"=-")
  print num," Tokens: ";
  for a=1 to num
    if (t$(a)="") then
      print "(EMPTY)";
    else 
      print t$(a);
    endif
    if (a&lt;num) print ","; 
  next a
  print
loop
          </pre>
	    This program prints the following output:
	    <p>
</p><pre class="screen">
Please enter a line: a
1 Tokens: a

Please enter a line:
0 Tokens:

Please enter a line: ab
1 Tokens: ab

Please enter a line: a=b
2 Tokens: a,b

Please enter a line: a-
1 Tokens: a

Please enter a line: a-=
1 Tokens: a

Please enter a line: =a-
1 Tokens: a

Please enter a line: a=-b
2 Tokens: a,b

Please enter a line: a--b-
2 Tokens: a,b

Please enter a line: -a==b-c==
3 Tokens: a,b,c
</pre><p>
</p>
	  </div>
	</div>
	<div class="refsection" id="id11162"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_split" title="split()">split</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_triangle"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  triangle
	   &#8212; draw a triangle
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
open window 100,100
triangle 100,100,50,50,100,50
fill triangle 50,100,100,50,200,200
clear fill triangle 20,20,10,10,200,200
</pre>
	</div>
	<div class="refsection" id="id11177"><h2>Description</h2>
	  
	  <p>The <code class="function">triangle</code>-command draws a triangle; it requires 6 parameters: The x- and y-coordinates of the three points making up the triangle. With the optional keywords <code class="function">clear</code> and <code class="function">fill</code> (which may appear both and in any sequence) the triangle can be cleared and filled respectively.</p>
	</div>
	<div class="refsection" id="id11185"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
do 
  phi=phi+0.2
  i=i+2
  color mod(i,255),mod(85+2*i,255),mod(170+3*i,255)
  dx=100*sin(phi):dy=20*cos(phi)
  fill triangle 100+20*sin(phi),100+20*cos(phi),100-20*sin(phi),100-20*cos(phi),100-80*cos(phi),100+80*sin(phi)
  sleep 0.1
loop
          </pre>
	    <p>This example draws a colored triangles until you get exhausted.</p>
	  </div>
	</div>
	<div class="refsection" id="id11192"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_open_window" title="open window">open window</a></code>, <code class="function"><a class="link" href="#ref_open_printer" title="open printer">open printer</a></code>, <code class="function"><a class="link" href="#ref_line" title="line">line</a></code>, <code class="function"><a class="link" href="#ref_circle" title="circle">circle</a></code><code class="function">, <a class="link" href="#ref_rectangle" title="rectangle">rectangle</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_trim"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  trim$()
	   &#8212; remove leading and trailing spaces from its argument
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
a$=trim$(b$)
</pre>
	</div>
	<div class="refsection" id="id11215"><h2>Description</h2>
	  
	  <p>The <code class="function">trim$</code>-function removes all whitespace from the left and from the right end of a string and returns the result. Calling <code class="function">trim$</code> is equivalent to calling <code class="function">rtrim$(ltrim$())</code>.</p>
	</div>
	<div class="refsection" id="id11223"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
do
  input "Continue ? Please answer yes or no: " a$
  a$=lower$(trim$(a$))
  if (len(a$)&gt;0 and a$=left$("no",len(a$)) exit
loop
          </pre>
	    <p>This example asks for an answer (<code class="literal">yes</code> or <code class="literal">no</code>) and removes spaces with <code class="function">trim$</code> to make the comparison with the string <code class="literal">"no"</code> more bulletproof.</p>
	  </div>
	</div>
	<div class="refsection" id="id11234"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_ltrim" title="ltrim$()">ltrim$</a></code>, <code class="function"><a class="link" href="#ref_rtrim" title="rtrim$()">rtrim$</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_true"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  true
	   &#8212; a constant with the value of 1
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
okay=true
</pre>
	</div>
	<div class="refsection" id="id11251"><h2>Description</h2>
	  
	  <p>The constant <code class="function">true</code> can be assigned to variables which will later appear in conditions (e.g. an <code class="function">if</code>-statement.</p>
	  <p><code class="function">true</code> may also be written as <code class="function">TRUE</code> or even <code class="function">TrUe</code>.</p>
	</div>
	<div class="refsection" id="id11262"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a string of all upper letters: " a$
if (is_upper(a$)) print "Okay"

sub is_upper(a$)
  if (a$=upper$(a$)) return true
  return false
end sub
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id11268"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_false" title="false">false</a></code></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_u"><div class="titlepage"><div><div><h2 class="title" style="clear: both">U</h2></div></div></div>
      

      <div class="refentry" id="ref_until"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  until
	   &#8212; end a <code class="function">repeat</code>-loop
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
repeat 
  &#8230;
until &#8230;
</pre>
	</div>
	<div class="refsection" id="id11288"><h2>Description</h2>
	  
	  <p>The <code class="function">until</code>-keyword ends a loop, which has been introduced by the <code class="function"><a class="link" href="#ref_repeat" title="repeat">repeat</a></code>-keyword. <code class="function">until</code> requires an expression (see <a class="link" href="#ref_conditions_and_expressions" title="Conditions and expressions">here</a> for details) as an argument; the loop will continue <span class="emphasis"><em>until</em></span> this condition evaluates to true.</p>
	</div>
	<div class="refsection" id="id11299"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
c=1
s=1
repeat
  l=c
  s=-(s+sig(s))
  c=c+1/s
  print c
until abs(l-c)&lt;0.000001
          </pre>
	    <p>This program calculates the sequence 1/1-1/2+1/3-1/4+1/5-1/6+1/7-1/8+ &#8230; ; please let me know, if you know against which value this converges.</p>
	  </div>
	</div>
	<div class="refsection" id="id11306"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_repeat" title="repeat">repeat</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_upper"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  upper$()
	   &#8212; convert a string to upper case
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
u$=upper$(a$)
</pre>
	</div>
	<div class="refsection" id="id11321"><h2>Description</h2>
	  
	  <p>The <code class="function">upper$</code>-function accepts a single string argument and converts it to all upper case.</p>
	</div>
	<div class="refsection" id="id11327"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
line input "Please enter a sentence without the letter 'e': " l$
p=instr(upper$(l$),"E")
if (p) then
  l$=lower$(l$)
  mid$(l$,p,1)="E"
  print "Hey, you are wrong, see here!"
  print l$
else
  print "Thanks."
endif
          </pre>
	    <p>This program asks for a sentence and marks the first (if any) occurrence of the letter 'e' by converting it to upper case (in contrast to the rest of the sentence, which is converted to lower case).</p>
	  </div>
	</div>
	<div class="refsection" id="id11334"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_lower" title="lower$()">lower$</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_using"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  using
	   &#8212; Specify the format for printing a number
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print a using "##.###"
print a using("##.###",",.")
</pre>
	</div>
	<div class="refsection" id="id11349"><h2>Description</h2>
	  
	  <p>The <code class="function">using</code>-keyword may appear as part of the <code class="function">print</code>-statement and specifies the format (e.g. the number of digits before and after the decimal dot), which should be used to print the number.</p>
	  <p>The possible values for the format argument (<code class="literal">"##.###"</code> in the synopsis above) are described within the entry for the <code class="function"><a class="link" href="#ref_str" title="str$()">str$</a></code>-function; especially the second line in the synopsis (<code class="literal">print a using("##.###",",.")</code>) will become clear after referring to <code class="function">str$</code>. In fact the <code class="function">using</code> clause is closely related to the <code class="function">str$</code>-function; the former can always be rewritten using the latter; i.e. <code class="literal">print foo using bar$</code> is always equivalent to <code class="literal">print str$(foo,bar$)</code>. Therefore you should check out <code class="function"><a class="link" href="#ref_str" title="str$()">str$</a></code> to learn more.</p>
	</div>
	<div class="refsection" id="id11368"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
for a=1 to 10
  print sqrt(ran(10000*a)) using "#########.#####"
next a
          </pre>
	    <p>This example prints a column of square roots of random number, nicely aligned at the decimal dot.</p>
	  </div>
	</div>
	<div class="refsection" id="id11375"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_print" title="print">print</a></code>, <code class="function"><a class="link" href="#ref_str" title="str$()">str$</a></code></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_v"><div class="titlepage"><div><div><h2 class="title" style="clear: both">V</h2></div></div></div>
      

      <div class="refentry" id="ref_val"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  val()
	   &#8212; converts a string to a number
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
x=val(x$)
</pre>
	</div>
	<div class="refsection" id="id11396"><h2>Description</h2>
	  
	  <p>The <code class="function">val</code>-function checks, if the start of
its string argument forms a floating point number and then returns this
number. The string therefore has to start with digits (only whitespace in front is allowed), otherwise the <code class="function">val</code>-function returns zero.</p>
	</div>
	<div class="refsection" id="id11403"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
input "Please enter a length, either in inches (in) or centimeters (cm) " l$
if (right$(l$,2)="in") then
  l=val(l$)*2.51
else
  l=val(l$)
print "You have entered ",l,"cm."
          </pre>
	    <p>This example queries for a length and checks, if it has been specified in inches or centimeters. The length is then converted to centimeters.</p>
	  </div>
	</div>
	<div class="refsection" id="id11410"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_str" title="str$()">str$</a></code></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_w"><div class="titlepage"><div><div><h2 class="title" style="clear: both">W</h2></div></div></div>
      

      <div class="refentry" id="ref_wait"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  wait
	   &#8212; pause, sleep, wait for the specified number of seconds
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
wait 4
</pre>
	</div>
	<div class="refsection" id="id11429"><h2>Description</h2>
	  
	  <p>The <code class="function">wait</code>-command has many different names: You may write <code class="function">pause</code>, <code class="function">sleep</code> or <code class="function">wait</code> interchangeably; whatever you write, <span class="application">yabasic</span> will always do exactly the same.</p>
	  <p>Therefore you should refer to the entry for the <code class="function"><a class="link" href="#ref_pause" title="pause">pause</a></code>-function for further information.</p>
	</div>
      </div>

      <div class="refentry" id="ref_wend"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  wend
	   &#8212; end a <code class="function"><a class="link" href="#ref_while" title="while">while</a></code>-loop
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
while a&lt;b
  &#8230;
wend
</pre>
	</div>
	<div class="refsection" id="id11452"><h2>Description</h2>
	  
	  <p>The <code class="function">wend</code>-keyword marks the end of a <code class="function"><a class="link" href="#ref_while" title="while">while</a></code>-loop. Please see the <code class="function"><a class="link" href="#ref_while" title="while">while</a></code>-keyword for more details.</p>
	  <p><code class="function">wend</code> can be written as <code class="function">end while</code> or even <code class="function">end-while</code>.</p>
	</div>
	<div class="refsection" id="id11466"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
line input "Please enter a sentence: " a$
p=instr(a$,"e")
while p
  mid$(a$,p,1)="E"
  p=instr(a$,"e")
wend
print a$
          </pre>
	    <p>This example reads a sentence and converts every occurrence of the letter <code class="literal">e</code> into uppercase (<code class="literal">E</code>).</p>
	  </div>
	</div>
	<div class="refsection" id="id11475"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_while" title="while">while</a></code> (which is just the following entry).</p>
	</div>
      </div>

      <div class="refentry" id="ref_while"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  while
	   &#8212; start a <code class="function">while</code>-loop
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
while &#8230;
  &#8230;
wend
</pre>
	</div>
	<div class="refsection" id="id11491"><h2>Description</h2>
	  
	  <p>The <code class="function">while</code>-keyword starts a <code class="function">while</code>-loop, i.e. a loop that is executed as long as the condition (which is specified after the keyword <code class="function">while</code>) evaluates to <code class="constant">true</code>.</p>
	  <p>Note, that the body of such a <code class="function">while</code>-loop will not be executed at all, if the condition following the <code class="function">while</code>-keyword is not true initially.</p>
	  <p>If you want to leave the loop prematurely, you may use the <code class="function"><a class="link" href="#ref_break" title="break">break</a></code>-statement.</p>
	</div>
	<div class="refsection" id="id11506"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
open #1,"foo"
while !eof(1)
  line input #1 a$
  print a$
wend
          </pre>
	    <p>This program reads the file <code class="literal">foo</code> and prints it line by line.</p>
	  </div>
	</div>
	<div class="refsection" id="id11514"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_until" title="until">until</a></code>, <code class="function"><a class="link" href="#ref_break" title="break">break</a></code>, <code class="function"><a class="link" href="#ref_wend" title="wend">wend</a></code>, <code class="function"><a class="link" href="#ref_do" title="do">do</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_origin"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  origin
	   &#8212; move the origin of a window
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
open window 200,200
origin "cc"
</pre>
	</div>
	<div class="refsection" id="id11535"><h2>Description</h2>
	  
	  <p>The <code class="function">origin</code>-command applies to graphic windows and moves the origin of the coordinate system to one of nine point within the window. The normal position of the origin is in the upper left corner of the window; however in some cases this is inconvenient and moving the origin may save you from subtracting a constant offset from all of your coordinates.</p>
	  <p>However, you may not move the origin to an arbitrary position; in horizontal position there are only three positions: left, center and right, which are decoded by the letters <code class="literal">l</code>, <code class="literal">c</code> and <code class="literal">r</code>. In vertical position the allowed positions are top, center and bottom; encoded by the letters <code class="literal">t</code>, <code class="literal">c</code> and <code class="literal">b</code>. Taking the letters together, you arrive at a string, which might be passed as an argument to the command; e.g. <code class="literal">"cc"</code> or <code class="literal">"rt"</code>.</p>
	</div>
	<div class="refsection" id="id11550"><h2>Example</h2>
	  100,100
	  <div class="informalexample">
	    <pre class="programlisting">
open window 200,200
window origin "cc"
circle 0,0,60
          </pre>
	    <p>This example draws a circle, centered at the center of the window.</p>
	  </div>
	</div>
	<div class="refsection" id="id11557"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_open_window" title="open window">open window</a></code></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_x"><div class="titlepage"><div><div><h2 class="title" style="clear: both">X</h2></div></div></div>
      

      <div class="refentry" id="ref_xor"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  xor()
	   &#8212; compute the exclusive or
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
x=xor(a,b)
</pre>
	</div>
	<div class="refsection" id="id11576"><h2>Description</h2>
	  
	  <p>The <code class="function">xor</code>-function computes the bitwise <span class="emphasis"><em>exclusive or</em></span> of its two numeric arguments. To understand the result, both arguments should be viewed as binary numbers (i.e. a sequence of digits 0 and 1); a bit of the result will then be 1, if exactly one argument has a 1 and the other has a 0 at this position in their binary representation.</p>
	  <p>Note, that both arguments are silently converted to integer values and that negative numbers have their own binary representation and may lead to unexpected results when passed to <code class="function">and</code>.</p>
	</div>
	<div class="refsection" id="id11585"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print xor(7,4)
          </pre>
	    <p>This will print <code class="computeroutput">3</code>. This result is obvious, if you note, that the binary representation of 7 and 4 are 111 and 100 respectively; this will yield 011 in binary representation or 2 as decimal.</p>
	    <p>The <code class="function">eor</code>-function is the same as the <code class="function">xor</code>-function; both are synonymous; however they have each their own description, so you may check out the entry of <code class="function"><a class="link" href="#ref_eor" title="eor()">eor</a></code> for a slightly different view.</p>

	  </div>
	</div>
	<div class="refsection" id="id11598"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_bitwise_and" title="and()">and</a></code>, <a class="link" href="#ref_bitwise_or" title="or()"><code class="function">or</code></a>, <a class="link" href="#ref_eor" title="eor()"><code class="function">eor</code></a>, <a class="link" href="#ref_bitnot" title="bitnot()"><code class="function">bitnot</code></a></p>
	</div>
      </div>

    </section>

    <section class="section" id="ref_special_characters"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Symbols and Special characters</h2></div></div></div>
      

      <div class="refentry" id="ref_hash"><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  #
	   &#8212; either a comment or a marker for a file-number
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
# This is a comment, but the line below not !
open #1,"foo"
</pre>
	</div>
	<div class="refsection" id="id11623"><h2>Description</h2>
	  
	  <p>The hash ('<code class="literal">#</code>') has two totally unrelated uses:</p>
	  <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <p>A hash might appear in commands related with file-io. <span class="application">yabasic</span> uses simple numbers to refer to open files (within <code class="function"><a class="link" href="#ref_input" title="input">input</a></code>, <code class="function"><a class="link" href="#ref_print" title="print">print</a></code>, <code class="function"><a class="link" href="#ref_peek" title="peek">peek</a></code> or <code class="function"><a class="link" href="#ref_eof" title="eof">eof</a></code>). In those commands the hash may precede the number, which species the file. Please see those commands for further information and examples; the rest of <span class="emphasis"><em>this</em></span> entry is about the second use (as a comment).</p>
	    </li><li class="listitem">
	      <p>As the <span class="emphasis"><em>very first</em></span> character within a line, a hash introduces comments (similar to <code class="function">rem</code>).</p>
	    </li></ul></div>
	  <p> '<code class="literal">#</code>' as a comment is common in most scripting languages and has a special use under Unix: If the <span class="emphasis"><em>very first line</em></span> of any Unix-program begins with the character sequence '<code class="literal">#!</code>' ("she-bang", no spaces allowed), the rest of the line is taken as the program that should be used to execute the script. I.e. if your <span class="application">yabasic</span>-program starts with '<code class="literal">#!/usr/local/bin/yabasic</code>', the program <code class="filename">/usr/local/bin/yabasic</code> will be invoked to execute the rest of the program. As a remark for windows-users: This mechanism ensures, that <span class="application">yabasic</span> will be invoked to execute your program; the ending of the file (e.g. <code class="literal">.yab</code>) will be ignored by Unix.</p>
	</div>
	<div class="refsection" id="id11655"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
# This line is a valid comment
print "Hello " : # But this is a syntax error, because
print "World!" : # the hash is not the first character !
          </pre>
	    <p>Note, that this example will produce a syntax error and is <span class="emphasis"><em>not</em></span> a valid program !</p>
	  </div>
	</div>
	<div class="refsection" id="id11663"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_input" title="input">input</a></code>, <code class="function"><a class="link" href="#ref_print" title="print">print</a></code>, <code class="function"><a class="link" href="#ref_peek" title="peek">peek</a></code> or <code class="function"><a class="link" href="#ref_eof" title="eof">eof</a></code>, <code class="function"><a class="link" href="#ref_double_slash" title="//">//</a></code>, <code class="function"><a class="link" href="#ref_rem" title="rem">rem</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_double_slash"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  //
	   &#8212; starts a comment
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
//  This is a comment !
</pre>
	</div>
	<div class="refsection" id="id11688"><h2>Description</h2>
	  
	  <p>The double-slash ('<code class="literal">//</code>') is (besides <code class="literal">REM</code> and '<code class="literal">#</code>') the third way to start a comment. '<code class="literal">//</code>' is the latest and greatest in the field of commenting and allows <span class="application">yabasic</span> to catch up with such cool languages like C++ and Java.</p>
	</div>
	<div class="refsection" id="id11698"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
// Another comment.
print "Hello world !" // Another comment
          </pre>
	    <p>Unlike the example given for '<code class="literal"><a class="link" href="#ref_hash" title="#">#</a></code>' this example is syntactically correct and will not produce an error.</p>
	  </div>
	</div>
	<div class="refsection" id="id11707"><h2>See also</h2>
	  
	  <p> <code class="function"><a class="link" href="#ref_hash" title="#">#</a></code>, <code class="function"><a class="link" href="#ref_rem" title="rem">rem</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_at_sign"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  @
	   &#8212; synonymous to <code class="function"><a class="link" href="#ref_at" title="at()">at</a></code>
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
clear screen
&#8230;
print @(a,b)
</pre>
	</div>
	<div class="refsection" id="id11726"><h2>Description</h2>
	  
	  <p>As '<code class="literal">@</code>' is simply a synonym for <code class="literal">at</code>, please see <code class="function"><a class="link" href="#ref_at" title="at()">at</a></code> for further information.</p>
	</div>
	<div class="refsection" id="id11735"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_at" title="at()">at</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_colon"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  :
	   &#8212; separate commands from each other
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print "Hello ":print "World"
</pre>
	</div>
	<div class="refsection" id="id11750"><h2>Description</h2>
	  
	  <p>The <span class="emphasis"><em>colon</em></span> ('<code class="literal">:</code>') separates multiple commands on a single line.</p>
	  <p>The <span class="emphasis"><em>colon</em></span> and the <span class="emphasis"><em>newline</em></span>-character have mostly the same effect, only that the latter, well, starts a new line too. The only other difference is their effect within the (so-called) <span class="emphasis"><em>short</em></span> <code class="function">if</code>, which is an <code class="function">if</code>-statement without the keyword <code class="function">then</code>. Please see the entry for <code class="function"><a class="link" href="#ref_if" title="if">if</a></code> for more details.</p>
	</div>
	<div class="refsection" id="id11766"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
if (a&lt;10) print "Hello ":print "World !"
          </pre>
	    <p>This example demonstrates the difference between colon and newline as described above.</p>
	  </div>
	</div>
	<div class="refsection" id="id11773"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_if" title="if">if</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_semicolon"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  ;
	   &#8212; suppress the implicit newline after a <code class="function"><a class="link" href="#ref_print" title="print">print</a></code>-statement
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print "foo",bar;
</pre>
	</div>
	<div class="refsection" id="id11790"><h2>Description</h2>
	  
	  <p>The semicolon ('<code class="literal">;</code>') may only appear at the last position within a <code class="function"><a class="link" href="#ref_print" title="print">print</a></code>-statement. It suppresses the implicit newline, which <span class="application">yabasic</span> normally adds after each <code class="function">print</code>-statement.</p>
	  <p>Put another way: Normally the output of each <code class="function">print</code>-statement appears on a line by itself. If you rather want the output of many <code class="function">print</code>-statements to appear on a single line, you should end the <code class="function">print</code>-statement with a semicolon.</p>
	</div>
	<div class="refsection" id="id11804"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print "Hello ";:print "World !"
          </pre>
	    <p>This example prints <code class="computeroutput">Hello World !</code> <span class="emphasis"><em>in a single line</em></span>.</p>
	  </div>
	</div>
	<div class="refsection" id="id11813"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_print" title="print">print</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_pow"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  ** or ^
	   &#8212; raise its first argument to the power of its second
	</p></div>
	<div class="refsynopsisdiv"><h2>Synopsis</h2>
	  <pre class="synopsis">
print 2**b
print 3^4
</pre>
	</div>
	<div class="refsection" id="id11828"><h2>Description</h2>
	  
	  <p><code class="function">**</code> (or <code class="function">^</code>, which is an
exact synonym), is the arithmetic operator of exponentiation; it requires one
number to its left and a second one to its right; <code class="function">**</code> then
raises the first argument to the power of the second and returns the
result. The result will only be computed if it yields a <span class="emphasis"><em>real</em></span> number (as opposed to a <span class="emphasis"><em>complex</em></span> number); this means, that the power can <span class="emphasis"><em>not</em></span> be computed, if the first argument is negative and the second one is fractional. On the other hand, the second argument can be fractional, if the first one ist positive; this means, that <code class="function">**</code> may be used to compute arbitrary roots: e.g. <code class="function">x**0.5</code> computes the square root of <code class="function">x</code>.</p>
	</div>
	<div class="refsection" id="id11842"><h2>Example</h2>
	  
	  <div class="informalexample">
	    <pre class="programlisting">
print 2**0.5
          </pre>
	  </div>
	</div>
	<div class="refsection" id="id11848"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_sqrt" title="sqrt()">sqrt</a></code></p>
	</div>
      </div>

      <div class="refentry" id="ref_comparison"><div class="refentry.separator"><hr/></div><div class="titlepage"/>
	
	<div class="refnamediv"><h2>Name</h2><p>
	  &lt; &lt;= &gt; &gt;= = == &lt;&gt; !=
	   &#8212; Compare numbers or strings
	</p></div>
	<div class="refsection" id="id11861"><h2>See also</h2>
	  
	  <p><code class="function"><a class="link" href="#ref_comparing_strings_or_numbers" title="Comparing strings or numbers">Comparing strings or numbers</a></code> for some background.</p>
	</div>
      </div>
    </section>
  </section>

  <section class="chapter" id="chapter_examples"><div class="titlepage"><div><div><h1 class="title">Chapter&#160;8.&#160;A few example programs</h1></div></div></div><div class="toc"><ul class="toc"><li><span class="section"><a href="#id1370">A very simple program</a></span></li><li><span class="section"><a href="#id1371">Graphics with bitmaps</a></span></li><li><span class="section"><a href="#id1372">A menu to choose from</a></span></li></ul></div>
    
    <section class="section" id="id1370"><div class="titlepage"><div><div><h2 class="title" style="clear: both">A very simple program</h2></div></div></div>
      
      <p>The program below is a very simple program:</p>
      <pre class="programlisting">
repeat
  input "Please enter the first number, to add " a
  input "Please enter the second number, to add " b
  print a+b
until a=0 and b=0
</pre>
      <p>This program requests two numbers, which it than adds. The process is repeated until you enter zero (or nothing) twice.</p>
    </section>

    <section class="section" id="id1371"><div class="titlepage"><div><div><h2 class="title" style="clear: both">Graphics with bitmaps</h2></div></div></div>
      
      <p><span class="application">yabasic</span> allows to retrieve and put back rectangular regions of the screen with simple commands:</p>
      <pre class="programlisting">
open window 200,200

rem prepare picture of a star
dim p(3,2)
for off=0 to 90 step 30
  for a=0 to 2
    phi = (off + 120*a)*2*pi/360
    p(a,0) = 50 + 20*cos(phi)
    p(a,1) = 50 + 20*sin(phi)
  next a
  fill triangle p(0,0),p(0,1),p(1,0),p(1,1),p(2,0),p(2,1)
next off

star$ = getbit$(30,30,80,80)
clear window

for a=0 to 200 step 10
  line a,0 to a,200:line 0,a to 200,a: rem draw some pattern on the screen
next a

for a=10 to 150 step 5
  saved$=getbit$(a,80,a+40,120): rem save old content of window
  putbit star$ to a,80,"t": rem put star at new location
  pause 0.5
  putbit saved$ to a,80: rem restore old window content
next a
</pre>
      <p>This program moves moves the picture of a star across the graphics window. The first part of the program draws such a star and then retrieves the bitmap with <code class="function">getbit$()</code>. <span class="application">Yabasic</span> stores bitmaps within ordinary strings and so the star-bitmap can simply be stored within the variable <code class="varname">star$</code>.</p>
<p>Once the program has prepared the bitmap-string, it puts it back into the window with the <code class="function">putbit</code>-command and various locations. Each time before the star-bitmap is put into the window, the prior content is saved within the variable <code class="varname">saved$</code> and restored later.</p>
    </section>

    <section class="section" id="id1372"><div class="titlepage"><div><div><h2 class="title" style="clear: both">A menu to choose from</h2></div></div></div>
      
      <p>This example program presents a menu (e.g. a predefined set of 3 choices) and lets the user choose one of them. The menu is similar (but simpler) to the one employed in the demo of <span class="application">yabasic</span></p>
      <pre class="programlisting">
//  Initialize menu
restore menudata
read menusize:dim menutext$(menusize)
for a=1 to menusize:read menutext$(a):next a

ysel=1
clear screen
blank$ = "                      "
hash$ = "########################################"
print colour("cyan","magenta") at(7,2) hash$
print colour("cyan","magenta") at(7,3) hash$
print colour("cyan","magenta") at(7,4) hash$
print colour("yellow","blue") at(8,3) " This is a simple menu to choose from "

for a=1 to menusize
  if (a=menusize) then yoff=1:else yoff=0:fi
  if (a=ysel) then
    print colour("blue","green") at(5,7+yoff+a) menutext$(a);
  else
    print at(5,7+yoff+a) menutext$(a);
  endif
next a
print at(3,15) "Select with cursor keys UP or DOWN (or letters u and d),"
print at(3,16) "Press RETURN or SPACE to choose, ESC to quit."

do

  k$=inkey$

  yalt=ysel

  switch k$
  case "up":case "u":
    if (ysel=1) then ysel=menusize else ysel=ysel-1 fi
    redraw()
    break
  case "down":case "d":
    if (ysel=menusize) then ysel=1 else ysel=ysel+1 fi
    redraw()
    break
  case " ":case "enter":case "right":
    if (ysel=menusize) end_it()
    print at(3,18) "You have chosen: " + menutext$(ysel) + blank$
    sleep 1
    print at(3,18) blank$ + blank$
    break
  case "esc":
    end_it()
  default:
    print at(3,18) "Invalid key: " + k$ + blank$
    sleep 1
    print at(3,18) blank$ + blank$
  end switch
loop 

//  redraw line
sub redraw()
  local yoff
  if (yalt=menusize) then yoff=1:else yoff=0:fi	
  print at(5,7+yalt+yoff) menutext$(yalt);
  if (ysel=menusize) then yoff=1:else yoff=0:fi
  print colour("blue","green") at(5,7+ysel+yoff) menutext$(ysel);
  return
end sub

// terminate program
sub end_it()
  print at(3,18) "Bye ..."
  sleep 1
  exit
end sub

//  Data section ...
label menudata
//  Data for main menu: Number and text of entries in main menu
data 4
data "   First Item            "
data "   Item number two       "
data "   Last Item             "
data "   None of the above     "
</pre>
      <p>Some interesting aspects from top to bottom:</p>
      <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	  <p>The text of the various menu-items is initialized at the top of the program; the needed text-strings are kept in <code class="function">data</code>-lines at the end of the program.</p>
	</li><li class="listitem">
	  <p>User-input is aquired with the <code class="function">inkey$</code>-function.</p>
	</li><li class="listitem">
	  <p>A <code class="function">switch</code>-statement is employed to process the input; several keys (e.g. <strong class="userinput"><code>right</code></strong> and <strong class="userinput"><code>enter</code></strong>) are handled in the same <code class="function">case</code>-clause.</p>
	</li><li class="listitem">
	  <p>Two subroutines <code class="function">redraw()</code> and <code class="function">end_it()</code> handle common work, that needs to be done at multiple places in the program.</p>
	</li></ul></div>
    </section>
  </section>


  <section class="chapter" id="chapter_copyright"><div class="titlepage"><div><div><h1 class="title">Chapter&#160;9.&#160;The Copyright of <span class="application">yabasic</span></h1></div></div></div>
    
    <p><span class="application">yabasic</span> may be copied under the terms of the <span class="emphasis"><em><a class="ulink" href="http://www.yabasic.de/content_mit.html" target="_top">MIT License</a></em></span>, which is distributed with <span class="application">yabasic</span> in the file <code class="filename">LICENSE</code>.</p>
    <p>The MIT License grants extensive rights as long as you keep the copyright notice present in most files untouched. Here is a list of things that are possible under the terms of the MIT License:</p>
    <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	<p>Put <span class="application">yabasic</span> on your own homepage or CD and even charge for the service of distributing <span class="application">yabasic</span>.</p>
      </li><li class="listitem">
	<p>Write your own <span class="application">yabasic</span>-programs, pack your program and <span class="application">yabasic</span> into a package and sell the whole thing.</p>
      </li><li class="listitem">
	<p>Modify <span class="application">yabasic</span> and add or remove features, sell the modified version without adding the sources.</p>
      </li></ul></div>
  </section>
</div>
  </body>
</html>