[ prog / sol / mona ]

prog


Monads,Async/Await : Algebraic Effects in C99

46 2021-01-15 11:21

Not, bad, here's the last challenge: Make C support the following:

roll {
case 0.5:
  printf("50%% chance\n");
  break;
case 0.2:
  printf("20%% chance\n");
  break;
default:
  printf("30%% chance\n");
  break;
}

using "case", "break" and "default" specifically is optional, I just want to see how you can extend something to still look like C.

(P.S. you have read the front page, right? You know that code can be inserted using backticks?)

69


VIP:

do not edit these