Skip to content

Coding Style #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 17, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions 1-js/03-code-quality/02-coding-style/1-style-errors/solution.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

You could note the following:
নিচের বিষয়গুলি টুকে রাখতে পারেন:

```js no-beautify
function pow(x,n) // <- no space between arguments
{ // <- figure bracket on a separate line
let result=1; // <- no spaces before or after =
for(let i=0;i<n;i++) {result*=x;} // <- no spaces
// the contents of { ... } should be on a new line
function pow(x,n) // <- আর্গুমেন্টেগুলোর মাঝে ফাঁকা নেই
{ // <- আলাদা লাইনে ব্যাকেট লিখা
let result=1; // <- সমান এর = আগে / পরে ফাঁকা নেই
for(let i=0;i<n;i++) {result*=x;} // <- ফাঁকা নেই
// কন্টেন্ট { ... } আলাদা লাইনে লিখা উচিৎ
return result;
}

let x=prompt("x?",''), n=prompt("n?",'') // <-- technically possible,
// but better make it 2 lines, also there's no spaces and missing ;
if (n<0) // <- no spaces inside (n < 0), and should be extra line above it
{ // <- figure bracket on a separate line
// below - long lines can be split into multiple lines for improved readability
let x=prompt("x?",''), n=prompt("n?",'') // <-- টেকনিক্যালি সম্ভব,
// কিন্তু ২ লাইনে লিখা ভালো, এছাড়াও কোন ফাঁকা নেই এবং সেলিকোমন (;) নেই
if (n<0) // <- ভেতরে কোন ফাঁকা নেই (n < 0), এবং উপড়ে কোন বাড়তি লাইন থাকা উচিৎ নয়
{ // <- আলাদা মাইলে ব্যাকেট
// নিচে- বড় লাইনগূলি কিছু খন্ডে ভাগ করে নিতে পারেন পাঠযোগ্যতা বাড়াতে।
alert(`Power ${n} is not supported, please enter an integer number greater than zero`);
}
else // <- could write it on a single line like "} else {"
else // <- এভাবে এক লাইনে লিখতে পারেন "} else {"
{
alert(pow(x,n)) // no spaces and missing ;
alert(pow(x,n)) // কোন ফাঁকা নেই, এবং সেলিকোমন (;) নেই
}
```

Expand Down
8 changes: 4 additions & 4 deletions 1-js/03-code-quality/02-coding-style/1-style-errors/task.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
importance: 4
গুরুত্ব: ৪
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
গুরুত্ব: ৪
importance: 4

এই লেখা টুকু অনুবাদ করা যাবে না।


---

# Bad style
# বাজে স্টাইল

What's wrong with the code style below?
নিচের কোডে কি সমস্যা আছে?

```js no-beautify
function pow(x,n)
Expand All @@ -25,4 +25,4 @@ else
}
```

Fix it.
ঠিক করুন।
Loading