Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,5 @@
|
|||
num = Math.ceil(Math.random() * 10)
|
||||
guess = prompt "Guess the number. (1-10)"
|
||||
while parseInt(guess) isnt num
|
||||
guess = prompt "YOU LOSE! Guess again. (1-10)"
|
||||
alert "Well guessed!"
|
||||
19
Task/Guess-the-number/CoffeeScript/guess-the-number-2.coffee
Normal file
19
Task/Guess-the-number/CoffeeScript/guess-the-number-2.coffee
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# This shows how to do simple REPL-like I/O in node.js.
|
||||
readline = require "readline"
|
||||
|
||||
do ->
|
||||
number = Math.ceil(10 * Math.random())
|
||||
interface = readline.createInterface process.stdin, process.stdout
|
||||
|
||||
guess = ->
|
||||
interface.question "Guess the number between 1 and 10: ", (answer) ->
|
||||
if parseInt(answer) == number
|
||||
# These lines allow the program to terminate.
|
||||
console.log "GOT IT!"
|
||||
interface.close()
|
||||
process.stdin.destroy()
|
||||
else
|
||||
console.log "Sorry, guess again"
|
||||
guess()
|
||||
|
||||
guess()
|
||||
Loading…
Add table
Add a link
Reference in a new issue