24 lines
488 B
Plaintext
24 lines
488 B
Plaintext
' FB 1.05.0 Win64
|
|
|
|
Function square(n As Integer) As Integer
|
|
Return n * n
|
|
End Function
|
|
|
|
Function cube(n As Integer) As Integer
|
|
Return n * n * n
|
|
End Function
|
|
|
|
Sub doCalcs(from As Integer, upTo As Integer, title As String, func As Function(As Integer) As Integer)
|
|
Print title; " -> ";
|
|
For i As Integer = from To upTo
|
|
Print Using "#####"; func(i);
|
|
Next
|
|
Print
|
|
End Sub
|
|
|
|
doCalcs 1, 10, "Squares", @square
|
|
doCalcs 1, 10, "Cubes ", @cube
|
|
Print
|
|
Print "Press any key to quit"
|
|
Sleep
|