-
-
Save rightfold/ba212630c98aa06046d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% cat test/data/conditional.vl | |
load console | |
def booleanToString(value: boolean): string do | |
if value then | |
"yes" | |
else | |
"no" | |
end | |
end | |
do | |
console.log(booleanToString(true)) | |
console.log(booleanToString(false)) | |
end | |
% esgenerate -c <(echo '{ "comment": true }') <(./vlinder.native test/data/conditional.vl) | |
/* @flow */ | |
'use strict'; | |
var __vlinder = require('vlinder/rt'); | |
var __global = __vlinder.global; | |
var console = __global.console; | |
module.exports.booleanToString = function (value /* : boolean */) | |
/* : string */ | |
{ | |
__vlinder.precondition('1 argument', arguments.length === 1); | |
if (value) { | |
return 'yes'; | |
} else { | |
return 'no'; | |
} | |
}; | |
(function () { | |
console.log(module.exports.booleanToString(true)); | |
console.log(module.exports.booleanToString(false)); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment