8 kyu
The 'if' function
14,278 of 34,509user578387
Description:
Create a function called _if
which takes 3 arguments: a value bool
and 2 functions (which do not take any parameters): func1
and func2
When bool
is truthy, func1
should be called, otherwise call the func2
.
Example:
_if(true, function(){console.log("True")}, function(){console.log("false")})
// Logs 'True' to the console.
Functional Programming
Fundamentals
Similar Kata:
Stats:
Created | Sep 13, 2014 |
Published | Sep 13, 2014 |
Warriors Trained | 58372 |
Total Skips | 4775 |
Total Code Submissions | 101979 |
Total Times Completed | 34509 |
JavaScript Completions | 14278 |
Ruby Completions | 1154 |
Python Completions | 11378 |
CoffeeScript Completions | 120 |
Haskell Completions | 878 |
Elixir Completions | 329 |
C++ Completions | 3504 |
Rust Completions | 1069 |
C# Completions | 1707 |
Lua Completions | 486 |
C Completions | 1139 |
NASM Completions | 77 |
Java Completions | 364 |
Total Stars | 326 |
% of votes with a positive feedback rating | 75% of 3197 |
Total "Very Satisfied" Votes | 2055 |
Total "Somewhat Satisfied" Votes | 662 |
Total "Not Satisfied" Votes | 480 |