Reverse String in Nim

Published on 28 April 2022 (Updated: 25 September 2022)

Reverse String in Nim

Welcome to the Reverse String in Nim page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

# For reversing a string passed in as a parameter
import os
import strutils

var text: string
try:
    text = paramStr(1)
except IndexError:
    echo "Usage: please input a string to reverse"
    quit(1)

var reversed_text: string
for i in countdown(len(text)-1, 0):
  reversed_text = reversed_text & text[i]

echo reversed_text

Reverse String in Nim was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.