There are more than 25 built-in run-time functions available in BScript.
Returns the absolute value of x.
This will print 2.6
print abs(-2.6)
Returns the value of PI (3.14159265359).
This will print the PI constant.
print "pi is", pi
Returns the sine of x, where x is given in radians.
Returns a number between -1 and 1.
To be written.
Returns the cosine of x, where x is given in radians.
Returns a number between -1 and 1.
To be written.
Returns the tangent of x, where x is given in radians.
To be written.
Calculates the arc sine of x; that is the value whose sine is x. If x falls outside the range -1 to 1, this function fails.
Returns the arc sine in radians, defined to be between -PI/2 and PI/2.
To be written.
Calculates the arc cosine of x; that is the value whose cosine is x. If x falls outside the range -1 to 1, this function fails.
Returns the arc sine in radians, defined to be between -PI/2 and PI/2.
To be written.
Calculates the arc tangent of x; that is the value whose tangent is x.
Returns the arc tangent in radians, defined to be between -PI/2 and PI/2.
To be written.
Returns the base-10 logarithm of x.
Returns the value of e raised to the power x. e is the base of natural logarithms.
Returns the non-negative square root of x. If x is negative, this function will fail.
Returns the largest integer less than or equal to x. Note that this is not trucated integer, for which see CINT.
This will print 4
print int(4.77)
Returns the trucated integer of x. See also function INT.
This will print -2
print cint(-2.3)
Converts a string to number.
This will print 2.3
print val("2.3")
Converts a number to string.
This will print 1.23
x=1.23
print str$(x)
Returns a character with ASCII code of asc
This will print A since 65 is ASCII code for character A.
print chr$(65)
Gets ASCII code of first character in string
This will print 72 since 72 is ASCII code for character H.
print asc("Hello")
Calculates length of the string s.
Returns the number of characters in s.
This will print 14.
name$="Linus Torvalds"
print len(name$)
Gets first n characters from string. Returns a new string.
This will print Linus
name$="Linus Torvalds"
print left$(name$,5)
Gets last n characters from string.
This will print Torvalds
name$="Linus Torvalds"
print right$(name$,8)
Gets n characters, starting at pos from string. If n is not specified, that this function will gets all characters starting from pos.
This will print Delano
name$="Franklin Delano Roosevelt"
print right$(name$,10,6)
Converts a string to uppercase. Return a new string with all characters converted to uppercase.
This will print BIG CITY
city$ = "big ciTY"
print upper$(city$)
Converts a string to lowercase. Return a new string with all characters converted to lowercase.
This will print romeo and juliet
title$ = "Romeo and Juliet"
print lower$(title$)
Returns current date as string with format yyyy-mm-dd
On April 20, 1980, this will print 1980-05-20
print date$
Returns current time as string with format hh:mm:ss
On 17:24, this will print 17:24
print time$
Returns a pseudo-random number between 0 and 1.
Initializes the seed for a new sequence of pseudo-random to be returned by function RND. The expression is optional, you might want to use function TIMER for this.
Returns number of seconds elapsed since midnight. On most cases, TIMER is used as the argument to RANDOMIZE.
randomize timer
Returns the environment variable associated with name.
This will print out your PATH environment variable.
print environ$("PATH")