yab

#!/boot/system/bin/yab

REM How to calculate the average of many number
REM In this example we generate with the random function a set of numbers and put them in the array number_array.
REM Look at the first for loop

REM With the second for loop we summaries all number together.
REM The summary will be division by the arraysize
REM Then we get the average of the numbers

dim Number_Array(5)
Number_Array_Size=arraysize(Number_Array(),1)
for i =0 to Number_Array_Size
        Number_Array(i)=int(ran(25))
        print Number_Array(i)
next i

for i =0 to Number_Array_Size
         Number=Number+Number_Array(i)
next i
print "The average of Number_Array is: "+str$(Number/Number_Array_Size)

In some programs is it possible that copied informationen from clipboard goes automaticly into a textedit or textcontrol.

In this code is a example to get the informationen from the clipboard automaticly.

#!/boot/home/config/bin/yab
window open 400,100 to 600,300, "Clipboard_test", "Clipboard_test" dim msg$(1)
while(not finished)
n = token(message$, msg$(), ":|")
for i = 1 to n
if (CLIPBOARD PASTE$="") then
else
draw flush "Clipboard_test"
draw text 10,10, CLIPBOARD PASTE$, "Clipboard_test"
endif
if(instr(msg$(i), "Quit")) finished = true
next i
wend

Tutorial by Lorenz Glaser(Lorglas) Feb 2022
Made available by BeSly the Haiku, BeOS and Zeta knowledge base.