-
Notifications
You must be signed in to change notification settings - Fork 0
Useful built in functions
Jose Guaro edited this page Oct 28, 2019
·
4 revisions
sNEK currently comes with a few built in functions:
-
input
: Has no arguments. Reads a single line from standard input and returns that line as a string. -
print
: Prints a string to stdout without a newline at after the string. Returns the same string. -
println
: same asprint
, but it appends a newline after the string has been printed. -
inc
: Given an integern
, it will return the integern+1
-
dec
: Given an integern
, it will return the integern-1
-
toStr
: Can be given either one int or boolean. Returns the string representation of such value. -
isBool
: Checks if a given value is a boolean, returns true if the value is a boolean, false if not. -
isInt
: Checks if a given value is an integer, returns true if the value is an integer, false if not. -
isStr
: Checks if a given value is a string, returns true if the value is a string, false if not. -
type
: Given a value, it will return the string representation of that type. - 'len' : Given a string, it returns the size of that string