LB Booster
Programming >> Liberty BASIC language >> DATE$() return type http://lbb.conforums.com/index.cgi?board=lblang&action=display&num=1433254386 DATE$() return type
Post by Richard Russell on Jun 2nd, 2015, 2:13pm
The Liberty BASIC DATE$() function is a little unusual in sometimes returning a string and sometimes returning a number, depending on the parameter supplied. Indeed that feature seems to confuse LB 4.04, for example it will accept the following code without error:
Code:
count$ = date$("days")
You would expect that to raise a 'Type mismatch' error (since it is attempting to assign a numeric value to a string variable) but it doesn't. However it leaves LB in a confused state because an error may be raised in a subsequent statement that accesses the count$ variable.
For maximum compatibility, LBB will accept both these forms without generating an error, and the resulting variable (whether numeric or string) is entirely valid:
Code:
count = date$("days") ' correct according to the LB help documents
count$ = date$("days") ' equivalent to count$ = str$(date$("days"))