LoginSignup
1
1

More than 5 years have passed since last update.

Coding Style

Last updated at Posted at 2012-07-22

単項演算子の後はスペースをいれる。ただし+/-はスペースを入れない。

if (! $foo) {
    # …
}
if (not $foo) {
    # …
}
my $foo = +10;
my $foo = -10;

二項演算子は前後にスペースを入れる。

print $foo + $bar;

if, whileなどの後はスペースを入れる。

if ($foo) {
    # ...
}
while ($foo) {
    # ...
}

関数呼び出し演算子 () の前はスペースを入れない。

foo();
$self->foo();

ブロック閉じ括弧 } の後は改行する。if (…) の後は改行しない。

if ($foo) {
    ...;
}
else {
    ...;
}
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1