tcanimport.nim 244 B

1234567891011121314151617181920
  1. discard """
  2. output: '''ABC
  3. nope'''
  4. """
  5. template canImport(x): bool =
  6. compiles:
  7. import x
  8. when canImport(strutils):
  9. import strutils
  10. echo "abc".toUpperAscii
  11. else:
  12. echo "meh"
  13. when canImport(none):
  14. echo "what"
  15. else:
  16. echo "nope"