Native Experiments
NebuLang introduces a unique concept known as "Native Experiments" to expand its functionality without the need for traditional functions. These experiments provide powerful capabilities while maintaining the language's minimalistic approach. Here are the native experiments available in NebuLang:
Print
exp Print(value: Any): Void
The Print
experiment allows you to display output to the console. It is a versatile experiment that can print values of various data types, making it a handy tool for debugging and displaying information.
Write
exp Write(str: String): Void
The Write
experiment is specifically designed for printing strings on standard output.
Read
exp Read(Void): String
The Read
experiment enables you to read input from the standard input and return it as a string.
Len
exp Len(value: String | Seq[Any]): Int
The Len
experiment calculates and returns the length of a string or a sequence.
Int
exp Int(value: Char | String | Bool): Int
The Int
experiment allows you to convert data types such as characters, booleans, or strings into integers.
Char
exp Char(value: Int): Char
The Char
experiment enables you to convert integers into characters.
String
exp String(value: Int | Char): String
The String
experiment provides the ability to convert integers or characters into strings.
Bool
exp Bool(value: Int | Char | String): Bool
The Bool
experiment facilitates the conversion of integers, characters, or strings into boolean values.
These examples demonstrate how to use each of the native experiments in NebuLang to perform various operations and conversions with different data types. You can use these experiments to simplify your code and work efficiently with data.
Last updated