Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7077083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:22:44+00:00 2026-05-28T06:22:44+00:00

In the case that each method and variable will only be used once ,

  • 0

In the case that each method and variable will only be used once, which is the more correct convention?

Creating as many variables as necessary:

var x = GmailApp.getInboxUnreadCount();
var email = GmailApp.getInboxThreads (0, x);

Composing the code in one line:

var email = GmailApp.getInboxThreads (0, GmailApp.getInboxUnreadCount());
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:22:44+00:00Added an answer on May 28, 2026 at 6:22 am

    The latter, within reason. But this is largely a matter of style in the simple cases.

    Meaning that if you have a function call that takes 10 arguments, and each of those arguments comes from a large function call itself, dont do this. Think of who gets your code base afterward.

    “Is this line of code readable using less local variables? Or do I need to break it up to better illustrate what the line is doing?” is the question you should ask yourself. And in this case, the latter is totally readable.


    In fact, I would argue the first example is less readable due to a useless local variable name x. If instead that were named better, it might be a more viable option.

    var unreadCount = GmailApp.getInboxUnreadCount();
    var email = GmailApp.getInboxThreads (0, unreadCount);
    

    This is better, but still pretty unnecessary in this very simple case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think that it used to the be the case that in Liferay 4,
I want to write a test case which will test a list of functions.
Is it the case that the entire restful verb is under a single all
I have a case that keeps coming up where I'm using a ListView or
We have a business case that would be perfect for multiple BackgroundWorkers. As an
I have a Selenium test case that enters dates into a date selector made
How do i get access to a control (linkbutton in my case) that is
I'm writing some test cases, and I've got a test case that is using
I am building an FTP utility class in C#. In the case that a
The use case is that I use one development machine for different source trees.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.