#include <conio.h> using namespace std; int main() { if (_kbhit()) { switch (_getch()) { // some code } } return 0; } 

I gave an example of code in c ++, go I know poorly, tell me how it can be implemented on it

1 answer 1

As I recall, conio.h is a header file for console input / output. So in general, you can submit a program on Go. (I understand that the functions _kbhint and _getc are self-written. I am not very familiar with crosses.)

 package main import ( "fmt" "os" ) func main () { for _, arg := rang os.Args[1:]{ if _kbhit(){ switch .. := _getch { // some code } } } }