Skip to content

Instantly share code, notes, and snippets.

@dokipen
Last active March 4, 2016 17:19
Show Gist options
  • Save dokipen/885a46fed98adb6da1cc to your computer and use it in GitHub Desktop.
Save dokipen/885a46fed98adb6da1cc to your computer and use it in GitHub Desktop.
var hello = 0;
var values = [1,2,3,4];
for (var i = 0; i < values.length; i++) {
hello += values[i];
}
console.log(hello);
# --------------------------------------
hello = 0
for i in [1, 2, 3, 4]:
hello += i
print hello
# --------------------------------------
hello = 0
[1, 2, 3, 4].each do |i|
hello += i
end
puts hello
# --------------------------------------
$hello = 0;
$data = [1, 2, 3, 4];
for ($i = 0; $i < count($data); $i++) {
$hello += $data[$i];
}
echo($hello);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment