various1.nim 768 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. discard """
  2. exitCode: 0
  3. outputsub: "Woof!"
  4. """
  5. import strutils
  6. echo("hello".to_upper())
  7. echo("world".toUpper())
  8. type
  9. Dog = object #<1>
  10. age: int #<2>
  11. let dog = Dog(age: 3) #<3>
  12. proc showNumber(num: int | float) =
  13. echo(num)
  14. showNumber(3.14)
  15. showNumber(42)
  16. for i in 0 .. <10:
  17. echo(i)
  18. block: # Block added due to clash.
  19. type
  20. Dog = object
  21. proc bark(self: Dog) = #<1>
  22. echo("Woof!")
  23. let dog = Dog()
  24. dog.bark() #<2>
  25. import sequtils, future, strutils
  26. let list = @["Dominik Picheta", "Andreas Rumpf", "Desmond Hume"]
  27. list.map(
  28. (x: string) -> (string, string) => (x.split[0], x.split[1])
  29. ).echo
  30. import strutils
  31. let list1 = @["Dominik Picheta", "Andreas Rumpf", "Desmond Hume"]
  32. for name in list1:
  33. echo((name.split[0], name.split[1]))