{"ScriptPreparationCode":null,"TestCases":[{"Name":"Recursive","Code":"function pangkatRec(x, y) { \r\n if (y \u003C 0) {\r\n return 0\r\n } else if (y == 0) {\r\n return 1\r\n } else {\r\n return x * pangkatRec(x, y - 1)\r\n }\r\n}\r\n\r\npangkatRec(2, 3)","IsDeferred":false},{"Name":"While loop","Code":"function pangkatImperatives(x, y) {\r\n if (y \u003C 0) {\r\n return 0;\r\n } else if (y === 0) {\r\n return 1;\r\n } else {\r\n let result = 1;\r\n while (y \u003E 0) {\r\n result *= x;\r\n y--;\r\n }\r\n return result;\r\n }\r\n}\r\n\r\npangkatImperatives(2, 3)","IsDeferred":false},{"Name":"While loop (other)","Code":"function pangkatImperatives(x, y) {\r\n let n = y \u002B 1; // n\u002B1 \r\n\r\n let result = 0;\r\n while (n--) {\r\n if (result \u003C 0) {\r\n result = 0\r\n } else if (result == 0){\r\n result = 1\r\n } else {\r\n result *= x;\r\n }\r\n }\r\n\r\n return result\r\n}\r\n\r\npangkatImperatives(2, 3)","IsDeferred":false}]}