Page 151 - Learn to Program - Basic-256
P. 151
Chapter 10: Functions and Subroutines – Reusing Code. Page 135
17
18 subroutine displaytime()
19 color blue
20 rect 100, 100, 200, 100
21 color yellow
22 text 100, 100, padtwo(hour) + ":" +
padtwo(minute) + ":" + padtwo(second)
23 refresh
24 end subroutine
25
26 function padtwo(x)
27 # if x is a single digit then prepend a zero
28 if x < 10 then x = "0"+x
29 return x
30 end function
Program 61: Subroutine Clock
Sample Output 61: Subroutine Clock
© 2019 James M. Reneau (CC BY-NC-SA 3.0 US)

