Files
enso/tests/test.nim
2025-12-26 14:30:13 -08:00

35 lines
663 B
Nim

import enso
import std/[strformat, sugar]
proc unsafe_void(str: string) =
echo str
proc unsafe_int(str: string): int =
echo str
result = 1
func add_two(x: int): int = x + 2
func main() =
run strput("Hello from Enso!")
let
out_void: IO[void] = lift () => unsafe_void("void")
out_int: IO[int] = lift () => unsafe_int("int")
out_void()
run strput(fmt"{out_int()}")
let
num_list: IO[seq[int]] = to_IO @[1, 2, 3, 4, 5]
list_added: IO[seq[int]] = num_list.map(add_two)
run strput(fmt"{list_added()}")
run strput("Enter a string")
let read: IO[string] = readstr(STDIN)
run strput(read())
when isMainModule:
main()