Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1002617 // confirm - have action confirmed by user before executing

JavaX fragment (include)

static class Confirm extends Status {
  O responder; // must contain an answer function
  
  *() {}
  *(O *responder) {}
  
  S answer(S s) {
    status(null); // always forget question after one line
    
    if (isYes(s))
      ret callAnswerMethod(responder, s);
    else if (isNo(s))
      ret "OK, cancelled";
    null;
  }
}

static S confirm(S msg, O responder) {
  status(new Confirm(responder));
  ret msg;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1002617
Snippet name: confirm - have action confirmed by user before executing
Eternal ID of this version: #1002617/1
Text MD5: 0c015eedf8e37d5647ba82e5bc173063
Author: stefan
Category: eleu
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-02-05 21:08:30
Source code size: 439 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 654 / 611
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#3000382 - Answer for ferdie (>> t = 1, f = 0)