Questions tagged [expression]

Combination of several programming symbols and values intending to produce a result

An expression is code before it gets evaluated. That is, evaluating an expression will give you a result.

Expressions can consists of combinations of variables, constants, operators, function calls, or whatever constructs are available in that language.

Many s have an expression data type, and an evaluation function (often called eval), where calling eval(an_expression) will calculate a result.

Related tags

7598 questions
114
votes
6 answers

Using the Swift if let with logical AND operator &&

We know that we can use an if let statement as a shorthand to check for an optional nil then unwrap. However, I want to combine that with another expression using the logical AND operator &&. So, for example, here I do optional chaining to unwrap…
Max MacLeod
  • 26,115
  • 13
  • 104
  • 132
99
votes
5 answers

Spring cron expression for every after 30 minutes

I have following Spring job to run after every 30 minutes. Please check my cron expression, is that correct? 0 0 0 * * 30 Here is a full cron job definition from the related Spring configuration file:
d-man
  • 57,473
  • 85
  • 212
  • 296
99
votes
11 answers

JavaScript: difference between a statement and an expression?

I asked this question earlier, and after thinking about the topic some more, I began to wonder where the seemingly fuzzy boundary between the meanings of the terms "statement" and "expression" lies. Are all statements also expressions? Where do the…
wwaawaw
  • 6,867
  • 9
  • 32
  • 42
97
votes
6 answers

Regex to get the words after matching string

Below is the content: Subject: Security ID: S-1-5-21-3368353891-1012177287-890106238-22451 Account Name: ChamaraKer Account Domain: JIC Logon ID: 0x1fffb Object: Object Server: Security Object Type: …
Chamara Keragala
  • 5,627
  • 10
  • 40
  • 58
90
votes
8 answers

What is the purpose of the unary plus (+) operator in C?

In C, it's legal to write something like: int foo = +4; However, as far as I can tell, the unary plus (+) in +4 is a no-op. Is it?
zneak
  • 134,922
  • 42
  • 253
  • 328
83
votes
5 answers

JavaScript expression to generate a 5-digit number in every case

for my selenium tests I need an value provider to get a 5-digit number in every case. The problem with javascript is that the api of Math.random only supports the generation of an 0. starting float. So it has to be between 10000 and 99999. So it…
Christopher Klewes
  • 11,181
  • 18
  • 74
  • 102
79
votes
3 answers

What's the difference between # , % and $ signs in Struts tags?

I'm working with Struts 2 and when I'm accessing ValueStack variables I don't know whether to use % or # or $. I try all of them until I find the correct one. Can anybody explain what is the difference between them?
Khashayar
  • 2,014
  • 3
  • 22
  • 31
78
votes
7 answers

Change some value inside the List

I have some list (where T is a custom class, and class has some properties). I would like to know how to change one or more values inside of it by using Lambda Expressions, so the result will be the same as the foreach loop bellow: NOTE: list…
Mitja Bonca
  • 4,268
  • 5
  • 24
  • 30
77
votes
1 answer

How to set property value using Expressions?

Given the following method: public static void SetPropertyValue(object target, string propName, object value) { var propInfo = target.GetType().GetProperty(propName, BindingFlags.Instance | BindingFlags.Public |…
Anastasiosyal
  • 6,494
  • 6
  • 34
  • 40
73
votes
10 answers

javascript - match string against the array of regular expressions

Is there a way in JavaScript to get Boolean value for a match of the string against the array of regular expressions? The example would be (where the 'if' statement is representing what I'm trying to achieve): var thisExpressions = [ '/something/',…
user398341
  • 6,339
  • 17
  • 57
  • 75
70
votes
4 answers

Boolean Expressions in SQL Select list

I want to create a SQL Select to do a unit test in MS SQL Server 2005. The basic idea is this: select 'Test Name', foo = 'Result' from bar where baz = (some criteria) The idea being that, if the value of the "foo" column is "Result", then I'd get a…
Craig Walker
  • 49,871
  • 54
  • 152
  • 212
70
votes
14 answers

Reporting Services Remove Time from DateTime in Expression

I'm trying to populate an expression (default value of a parameter) with an explicit time. How do I remove the time from the the "now" function?
Jeff
  • 8,020
  • 34
  • 99
  • 157
69
votes
2 answers

XPath - Difference between node() and text()

I'm having trouble understanding the difference between text() and node(). From what I understand, text() would be whatever is in between the tags apple which is apple in this case. Node would be whatever that node actually is, which…
Pztar
  • 4,274
  • 6
  • 33
  • 39
67
votes
1 answer

PropertyExpression is missing

I try to write a simple example using Expressions, but have a strange bug: I can't use PropertyExpression at compile time. When I write it I get an error and it doesn't compile But in runtime at breakpoint I can write var runtimeBody =…
Alex Zhukovskiy
  • 9,565
  • 11
  • 75
  • 151
67
votes
2 answers

What is the XPath expression to find only the first occurrence?

I used this Xpath expression "//span[@class='Big']" and got all elements in that page that are under tag and class='Big'. My question is what if I want just the first occurrence on the page, not all occurrences, what would be the correct…
Narin
  • 773
  • 1
  • 5
  • 5