print(value)Toy Basic is designed to work with a graphical window. Usually, when you want to print/draw text in a graphical window, you should provide coordinates in addition to the text. There is a function DrawText in Toy Basic for that. Though sometimes you may want to write a simple program performing math calculations of text parsing, and you do not want to think about coordinates. Function PRINT is perfect for such cases. It just prints text line by line from top to down. When you use function ClearScreen, all text is cleared. Here is an example:
function PrintLegend()
SetColor("blue")
print("Click mouse to print coordinates, press ESC to clear screen")
end function
function OnMouseUp(x, y)
SetColor("white")
print("clicked at (" & x & ", " & y & ")")
end function
function OnKeyboard(c)
if c = "ESC"
ClearScreen()
PrintLegend()
end if
end function
PrintLegend()
See also: