Keyboard input/Obtain a Y or N response: Difference between revisions

(→‎{{header|Forth}}: Add Fortran)
Line 1,031:
[N] msg$ = "You entered [N]o" : goto [loop]
</lang>
=={{header|Rust}}==
==={{Library|Ncurses}}==
<lang rust>//cargo-deps: ncurses
 
extern crate ncurses;
use ncurses::*;
 
fn main() {
initscr();
loop {
printw("Yes or no? ");
refresh();
 
match getch() as u8 as char {
'Y'|'y' => {printw("You said yes!");},
'N'|'n' => {printw("You said no!");},
_ => {printw("Try again!"); continue;},
}
break
}
refresh();
endwin();
}</lang>
 
=={{header|Scala}}==