Terminal control/Positional read: Difference between revisions

m (→‎{{header|ZX Spectrum Basic}}: Regularize non-standard header markup)
Line 224:
The character at column 3, row 6 is 'A'
</pre>
 
=={{header|Nim}}==
{{trans|Raku}}
{{trans|Julia}}
{{libheader|nim-ncurses}}
This Nim version is inspired by Raku and Julia versions.
<lang Nim>import random, sequtils, strutils
import ncurses
 
randomize()
 
let win = initscr()
assert not win.isNil, "Unable to initialize."
 
for y in 0..9:
mvaddstr(y.cint, 0, newSeqWith(10, sample({'0'..'9', 'a'..'z'})).join())
 
let row = rand(9).cint
let col = rand(9).cint
let ch = win.mvwinch(row, col)
 
mvaddstr(row, col + 11, "The character at ($1, $2) is $3.".format(row, col, chr(ch)))
mvaddstr(11, 0, "Press any key to quit.")
refresh()
discard getch()
 
endwin()</lang>
 
{{out}}
<pre>tw5bl8mhvl
37t0nvwjhr
055co0b3hm
409stl3jgv The character at (3, 8) is g.
a9j5354rci
o5ymlrtgt2
9yjag11u7n
2nv32g6s7x
3l1zujlpl2
opkl6us0mf
 
Press any key to quit.</pre>
 
=={{header|Perl}}==
Anonymous user