Employers: discover CodinGame for tech hiring
CodinGame - Home
ACTIVITIES
PRACTICE
COMPETE
COOPERATE
LEARN
EVENTS
COMMUNITY
CONTRIBUTIONS
LIVE STREAMS
DISCORD
FORUMS
BLOG
Log In
Sign Up
A Babel of Languages on CodinGame
TBali
36.7K views
01
Intro
02
C#
03
Java
04
PHP
05
Javascript
06
F#
07
Haskell
08
Python
09
Pascal
10
C++
11
C
12
Rust
13
Bash
14
Dart
15
Go
16
Groovy
17
Kotlin
18
Perl
19
Ruby
20
Scala
21
Swift
22
VB.NET
23
Clojure
24
D
25
Lua
26
Objective-C
27
OCaml
28
Typescript
29
Conclusion
19/29
Ruby
Previous:
Perl
Next:
Scala
Ruby
Checking the sample code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#m = gets.chomp
m = "CG"
b = ""
m.each_byte { |w|
b += ('%7.7s' % w.ord.to_s(2)).gsub(' ', '0')
}
c = ["00", "0"]
ans = c[b[0].to_i] + " 0"
for i in 1..b.length-1
ans += (b[i] == b[i - 1] ? "0" : " " + c[b[i].
to_i] + " 0")
end
# STDERR.puts "Debug messages..."
print ans
Run
Looking at the syntax
TODO
Other characteristics
TODO
Ruby excels at
Code Golf
. You can write really short code in it.
Resources to check
Overview on Wikipedia
Official documentation
Coming next...
39
2
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
Suggested playgrounds
CGFunge Batch Runner
By
Marchete
4,553
9
0
Wie man die Programmierfähigkeiten von Entwicklern vor der Einstellung testet
By
[CG]OlogN
18.6K
6
0
Swapping languages on CodinGame (a.k.a. system() calls)
By
TBali
2,009
9
0
JavaScript Array Methods
By
SofienDerbel
2,683
72
0
CodinGame - Home
ABOUT US
CAREERS
PRIVACY
FAQ
CodinGame - Work
The #1 tech hiring platform
SCREENING
RETAIN
ABOUT US
CAREERS
PRIVACY
FAQ
Facebook
YouTube
Twitter
LinkedIn
FR
EN
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants
Keyboard Shortcuts:
?
Show / hide this help menu
×