Keyboard input/Keypress check: Difference between revisions
Content added Content deleted
Line 720: | Line 720: | ||
time.Sleep(500 * time.Millisecond) |
time.Sleep(500 * time.Millisecond) |
||
}</lang> |
}</lang> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
You don't need external dependencies to achieve this. You can use a channel and set a timeout on it. |
You don't need external dependencies to achieve this. You can use a channel and set a timeout on it. |
||
::<lang go>package main |
::<lang go>package main |
||
Line 751: | Line 769: | ||
fmt.Println("Time out!") |
fmt.Println("Time out!") |
||
} |
} |
||
}</lang> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
}</lang> |
}</lang> |
||