我正在用Java編寫Atoi函數。它對+ ve整數運行良好。但是我想要的是,當我輸入一個負整數時,它會給我一個錯誤。所以我試着在我的課堂上包括繼續發言。實施的班級是: class Atoi {
int atoi(String tmp) {
int result = 0;
for (int i = 0; i < tmp.length(); i++) {
這是一個意外的查找。一個非常基本的Ruby的問題,我不碰巧碰上之前的事情: a = "a"
if a
test = "yes" if a == "a" else "no"
else
test = "no"
end
運行這會產生錯誤: syntax error, unexpected kELSE, expecting kEND
貌似嵌套oneliner流溢到封閉的