Skip to content

Instantly share code, notes, and snippets.

@xaicron
Created April 1, 2012 14:59
Show Gist options
  • Save xaicron/2275943 to your computer and use it in GitHub Desktop.
Save xaicron/2275943 to your computer and use it in GitHub Desktop.
#!/usr/bin/env tora
/* string section */
say("# string");
my $str = "Hello, Tora";
say($str, $str.length);
/* array section */
say("# array");
my $array = [3, 2, 1];
say($array.size);
$array.map(-> $e { say($e) });
$array.push("hoge");
$array.pop;
$array.unshift("fuga");
$array.shift;
my $new_array = $array.sort;
say($new_array.join(" "));
/* hash section */
say("# hash");
my $hash = {foo => "bar", hoge => "fuga"};
say($hash.keys.join(" "));
say($hash.values.join(" "));
$hash.delete("foo");
say($hash.exists("foo"));
/* condition */
say("# condition");
if $str.length > 10 {
say("mattn");
}
else {
say("yappo");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment