Libraryless. Click here for Pure Java version (2766L/18K).
1 | sclass WaitForName { |
2 | S question; |
3 | |
4 | persistently swappable S answer(S s) { |
5 | if (isCancelCommand(s)) ret cancel(); |
6 | S name = nameFromInput(s); |
7 | if (name != null) { |
8 | cancelSilently(); |
9 | print("Processing name: " + quote(name)); |
10 | ret processName(s); |
11 | } |
12 | ret otherInput(s); |
13 | } |
14 | |
15 | persistently swappable S nameFromInput(S s) { ret s; } |
16 | persistently swappable S otherInput(S s) { ret "I don't understand. " + question; } |
17 | persistently swappable S processName(S name) { ret "You said: " + name; } |
18 | persistently swappable bool isCancelCommand(S s) { ret match("cancel", s); } |
19 | persistently swappable void cancelSilently() { print("Cancelling"); } |
20 | persistently swappable S cancel() { cancelSilently(); ret "Action cancelled"; } |
21 | } |
Began life as a copy of #1027545
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027546 |
Snippet name: | WaitForName |
Eternal ID of this version: | #1027546/8 |
Text MD5: | 62d747184a7cd69fe0c60b242f36dada |
Transpilation MD5: | 728d11339bdd77a060b408d5cfa6a23f |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-03-23 15:50:41 |
Source code size: | 783 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 244 / 601 |
Version history: | 7 change(s) |
Referenced in: | [show references] |