Skip to content

Useful built in functions

Jose Guaro edited this page Oct 28, 2019 · 4 revisions

Built-in functions in sNEK

sNEK currently comes with a few built in functions:

  1. input : Has no arguments. Reads a single line from standard input and returns that line as a string.
  2. print : Prints a string to stdout without a newline at after the string. Returns the same string.
  3. println : same as print , but it appends a newline after the string has been printed.
  4. inc : Given an integer n, it will return the integer n+1
  5. dec : Given an integer n, it will return the integer n-1
  6. toStr : Can be given either one int or boolean. Returns the string representation of such value.
  7. isBool : Checks if a given value is a boolean, returns true if the value is a boolean, false if not.
  8. isInt : Checks if a given value is an integer, returns true if the value is an integer, false if not.
  9. isStr : Checks if a given value is a string, returns true if the value is a string, false if not.
  10. type : Given a value, it will return the string representation of that type.
  11. 'len' : Given a string, it returns the size of that string
Clone this wiki locally