for loop - Key check in ruby whether the enter key is char or digit -
i have programme in ruby asks come in number. when come in char, want terminate loop , show sum of entered integers.
you can check if entered digit or not way:
i = gets.chomp # reading input homecoming unless =~ /\d/
ruby for-loop key condition do-while
No comments:
Post a Comment