1
0
Fork 0
forked from fun/fun
fun/examples/typeof.fun

50 lines
708 B
Standard ML
Executable file

#!/usr/bin/env fun
/*
* This file is part of the Fun programming language.
* https://hanez.org/project/fun/
*
* Copyright 2025 Johannes Findeisen <you@hanez.org>
* Licensed under the terms of the Apache-2.0 license.
* https://opensource.org/license/apache-2-0
*/
print("=== Typeof test start ===")
// Array
a = [1, 2, 3]
print(typeof(a))
fun f()
print("A function!")
// Function
print(typeof(f))
f()
// Map
m = { "x": 1, "y": 2, "move": move }
print(typeof(m))
// Nil
nil x = nil
print(typeof(x))
// Number
number n = 10
print(typeof(n))
string s = "Have fun!"
print(typeof(s))
print("=== Typeof test end ===")
/* Expected output:
Array
Function
A function!
Map
Nil
Number
String
*/