Присвоение сравнений: скобки не ставим, если там один оператор, иначе ставим.
$hasOrders = count($orders) > 0;
$isSuperman = (count($orders) > 0 && $user->canFly());
package main | |
import ( | |
"bytes" | |
"testing" | |
) | |
type A struct { | |
b interface{} | |
} |
def print_ledder (step, max_number ): | |
if step > max_number: | |
return | |
bound = step + 1 | |
print (' '.join(str(x) for x in list(range(1, bound)))) | |
print_ledder(bound, max_number) | |
n = int(input()) | |
print_ledder(1, n) |
import math | |
def square(): | |
n = int(input()) | |
if n!= 0: | |
square() | |
if round(math.sqrt(n)) == math.sqrt(n): | |
print(n) | |
def read_float(): | |
return float(input()) | |
a = read_float() | |
b = read_float() | |
c = read_float() | |
d = read_float() | |
e = read_float() | |
f = read_float() |
while True: | |
try: | |
count = int(input('Please enter count: ')) | |
if count > 10: | |
print('What\'s wrong with you? This is too much!') | |
continue | |
if count < 1: | |
print('I can\'t count something less than one time.') | |
continue | |
except ValueError: |
public class Handler { | |
// all stuff for establishing and reloading connection go here | |
private ConnectionManager manager; | |
private void handle() throws UnreachableServerException { | |
connection = manager.getConnection("someId"); | |
// Here we are using 100% good connection | |
} | |
} |
<?php | |
namespace Just\A\Test; | |
trait A { | |
public function speakA() { | |
return true; | |
} | |
} |
<?php | |
class StaticClass { | |
public static function modifySubscriber ($number){ | |
echo 'Hello-world'; | |
if ($number < 400000 | |
|| ($number >= 404000 && $number < 404999) | |
|| $number >= 406000) { | |
throw new Exception('invalid phone number'); |