We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 96be310 commit 2b04101Copy full SHA for 2b04101
docs/Runtime Environment/IO.md
@@ -207,3 +207,19 @@ else
207
print("chmod is not available on this platform.")
208
end
209
```
210
+
211
+---
212
+### `io.unique`
213
+Generate a unique file name by appending a number when a conflict occurs.
214
+#### Parameters
215
+1. The base file name without extension.
216
+2. The file extension.
217
+#### Returns
218
+A string representing a file name that does not already exist.
219
+```pluto
220
+-- assuming index.pluto exists
221
+print(io.unique("index", "pluto")) --> index (2).pluto
222
+```
223
224
+print(io.unique("file_that_doesnt_exist", "pluto")) --> file_that_doesnt_exist.pluto
225
0 commit comments