Quackit Logo

VBScript Operators

  • VBScript Functions

A list of operators available in VBScript.

In previous lessons, we've used the "equals" operator to assign a value to a variable. We've also used it to perform a test against a given condition (for example, the If statements).

In VBScript, operators are used to perform an operation. For example, an operator could be used to assign a value to a variable. An operator could also be used to compare two values.

Below is a listing of VBScript operators and a brief description of them. Don't worry if you don't understand all of them at this stage - just bookmark this page for reference and return whenever you need to.

Artithmetic Operators

Assignment operator, comparison operators, logical operators, concatenation operators.

VBScript Language Reference

Office vbscript.

© 1999 Microsoft Corporation. All rights reserved .

Get in touch

Submit feedback about this site to:

  • [email protected]

Guru99

VBScript Operators: Logical (AND, OR) Arithmetic, Comparison Example

Christina Tyler

VBScript Operators

An Operator works either on values or variables to perform some task. Operators are very crucial in programming because you cannot assign values to variables or perform tasks without them.

Suppose, you want to calculate the sum of two variables a and b and save the result in another variable c.

Here, a, b and c are operands and + and = are the operators.

There are mainly three kinds of operators in VBScript: Arithmetic, Comparison and Logical Operators.

VBScript Arithmetic Operators

VBS Arithmetic operators, as the name indicate, are used for arithmetic calculations.

Different arithmetic operators are

  • + (addition)
  • – (subtraction)
  • * (multiplication)
  • / (division)
  • % (modulus)
  • ^ (exponentiation)
  • & (concatenation)

You might be familiar with the first four arithmetic operators as we use them commonly.

The modulus operator is used to find the remainder after a division. For example, 10%3 is equal to 1.

The exponentiation operator is equivalent to “the power of” in mathematics. For example, 2^3 is equal to 8.

The concatenation operator is used to concatenate two string values.

For example, “Hello” & ” John” will return “Hello John”.

VBScript Comparison Operators

Comparison operators are used to compare two values.

Different comparison operators are == , <>, < , >, <= and >=. Suppose, you have two variables a and b with values 5 and 9 respectively, then the results for the following comparison will be like this:

VBScript Logical operators: AND, OR

Logical operators are used for logical operations.

Some of the logical operators are AND, OR, NOT and XOR.

Suppose, you have two variables x and y with values true and false respectively, then the results for the following logical operations will be like this:

Code Example

Step 1) Copy the following code into an editor

Step 2) Save the file as operator.html in your preferred location. Now open the file in Internet Explorer and your screen will look like this.

VBScript Logical Operators

What is Operator Precedence?

When several operators occur in an expression, each part is evaluated in a predetermined order called operator precedence. When expressions contain operators from more than one category-

  • arithmetic operators are evaluated first
  • comparison operators are evaluated next
  • logical operators are evaluated last

Comparison operators all have equal precedence; that is, they are evaluated in the left-to-right order in which they appear.

Arithmetic operators are evaluated in the following order:

  • exponentiation
  • multiplication
  • addition and subtraction
  • and finally concatenation.

Logical operators are evaluated in the following order:

You can use parentheses (opening and closing brackets) to change the normal order of precedence to the way you want. Within parentheses, normal operator precedence is maintained.

For example, if you try to calculate the expression a = 5-2*2/5^3, what you expect as the result? The result will be 4.968. How? The exponentiation comes first, then come multiplication and division and finally comes subtraction. So the above expression gets calculated like this: 5-2*2/(5^3) –> 5-(2*2)/125 –> 5-(4/125) –> 5-.032 –> 4.968.

Suppose, you want to calculate 5-2 first, then you should write the expression as a = (5-2)*2/5^3. Now you get the value of as a as 3*2/5^3 –> 3*2/125–>6/125 –> 0.048. You can try the given below code.

Step 2) Save the file as precedence.html in your preferred location. Now open the file in Internet Explorer and your screen will look like this.

VBScript Operator Precedence

Step 3) Change the expression a to (5-2)*2/5^3 and save the file. Now check the output and your output will be like this:

VBScript Operator Precedence

VBScript Constants

While coding in VBS, you might have to use constants at times. A constant is a meaningful name that replaces a number or string that will never change. For example, suppose you want to use the constant ? in your code. It is obvious that the value of the constant ? will not change. So, you can create a constant named “pi” and use it wherever you want. You need to use the keyword “const” in order to declare a constant. For example, you can declare a constant named pi and assign the value of ? to it like this:

After declaring a constant, if you try to change its value, then you will get an error.

While naming the constants, you need to be careful not to use the predefined VBScript constants. The best preventive measure is to avoid names starting with vb because all VBScript predefined constants start with vb. Some examples are vbRed, vbSunday, vbArray and so on. You can use these predefined VBScript constants in your code as you want.

Try the code given below to make the concept clearer.

Save the file as constant.html in your preferred location. Now open the file in Internet Explorer and your screen will look like this.

VBScript Constants

  • Operators are used to assigning values to variables or perform different kinds of tasks. There are mainly three kinds of operators in VBScript : Arithmetic, Comparison and Logical Operators.
  • Operator precedence is the order in which operators are evaluated normally when several operations occur in an expression. You can use parenthesis to override the operator precedence.
  • A constant is a meaningful name that replaces a number or string that will never change.
  • What is VBScript? Introduction & Examples
  • VBScript Variable Declaration with Data Types: Dim, String, Boolean
  • VBScript Conditional Statement: IF Else, ElseIF, Select Case Example
  • VBScript Loops: Do While, Do Until, While, For Each (Example)
  • VBScript Functions & Procedures with Example
  • VBScript Tutorial for Beginner: Learn in 3 Days
  • Top 25 VBScript Interview Questions and Answers (2024)
  • Save the file as condition1.htm in the vbstutorial folder.
  • Preview the file in your browser.
  • After previewing the page, return to your text editor.
  • After previewing the form, return to your text editor.
  • Trending Now
  • Foundational Courses
  • Data Science
  • Practice Problem
  • Machine Learning
  • System Design
  • DevOps Tutorial

Assignment Operators in Programming

  • Binary Operators in Programming
  • Operator Associativity in Programming
  • C++ Assignment Operator Overloading
  • What are Operators in Programming?
  • Assignment Operators In C++
  • Bitwise AND operator in Programming
  • Increment and Decrement Operators in Programming
  • Types of Operators in Programming
  • Logical AND operator in Programming
  • Modulus Operator in Programming
  • Solidity - Assignment Operators
  • Augmented Assignment Operators in Python
  • Pre Increment and Post Increment Operator in Programming
  • Right Shift Operator (>>) in Programming
  • JavaScript Assignment Operators
  • Move Assignment Operator in C++ 11
  • Assignment Operators in Python
  • Assignment Operators in C
  • Subtraction Assignment( -=) Operator in Javascript

Assignment operators in programming are symbols used to assign values to variables. They offer shorthand notations for performing arithmetic operations and updating variable values in a single step. These operators are fundamental in most programming languages and help streamline code while improving readability.

Table of Content

What are Assignment Operators?

  • Types of Assignment Operators
  • Assignment Operators in C++
  • Assignment Operators in Java
  • Assignment Operators in C#
  • Assignment Operators in Javascript
  • Application of Assignment Operators

Assignment operators are used in programming to  assign values  to variables. We use an assignment operator to store and update data within a program. They enable programmers to store data in variables and manipulate that data. The most common assignment operator is the equals sign ( = ), which assigns the value on the right side of the operator to the variable on the left side.

Types of Assignment Operators:

  • Simple Assignment Operator ( = )
  • Addition Assignment Operator ( += )
  • Subtraction Assignment Operator ( -= )
  • Multiplication Assignment Operator ( *= )
  • Division Assignment Operator ( /= )
  • Modulus Assignment Operator ( %= )

Below is a table summarizing common assignment operators along with their symbols, description, and examples:

Assignment Operators in C:

Here are the implementation of Assignment Operator in C language:

Assignment Operators in C++:

Here are the implementation of Assignment Operator in C++ language:

Assignment Operators in Java:

Here are the implementation of Assignment Operator in java language:

Assignment Operators in Python:

Here are the implementation of Assignment Operator in python language:

Assignment Operators in C#:

Here are the implementation of Assignment Operator in C# language:

Assignment Operators in Javascript:

Here are the implementation of Assignment Operator in javascript language:

Application of Assignment Operators:

  • Variable Initialization : Setting initial values to variables during declaration.
  • Mathematical Operations : Combining arithmetic operations with assignment to update variable values.
  • Loop Control : Updating loop variables to control loop iterations.
  • Conditional Statements : Assigning different values based on conditions in conditional statements.
  • Function Return Values : Storing the return values of functions in variables.
  • Data Manipulation : Assigning values received from user input or retrieved from databases to variables.

Conclusion:

In conclusion, assignment operators in programming are essential tools for assigning values to variables and performing operations in a concise and efficient manner. They allow programmers to manipulate data and control the flow of their programs effectively. Understanding and using assignment operators correctly is fundamental to writing clear, efficient, and maintainable code in various programming languages.

Please Login to comment...

Similar reads.

  • Programming

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

Assigns a value to a variable or property.

Any variable or any writable property.

Any numeric or string literal, constant, or expression.

The name on the left side of the equal sign can be a simple scalar variable or an element of an array. Properties on the left side of the equal sign can only be those properties that are writable at run time.

Requirements

Other resources, in vbsedit, you only need to press f1 to get help for the keyword under the cursor.

Download    Home    Copyright © 2001-2024 aders ο ft

  • What is PROMOTIC
  • PROMOTIC News
  • Documentation PROMOTIC
  • Freeware PROMOTIC
  • PROMOTIC school version
  • Applications development
  • Application references
  • PROMOTIC videos on Youtube
  • Documentation
  • Licence order
  • Business conditions
  • PROMOTIC 9.0
  • PROMOTIC 8.3
  • PROMOTIC 8.2
  • PROMOTIC 8.1
  • PROMOTIC 8.0
  • PROMOTIC 7.5
  • Stable version - Download
  • Info materials
  • Presentation for you
  • For schools
  • Technical support
  • Distributors
  • System integrators
  • MICROSYS - Company profile
  • Rewards and media
  • GDPR and Cookies

Addition (+) - operator of language VBScript

Description:.

VB.Net Programming Tutorial

  • VB.Net Basic Tutorial
  • VB.Net - Home
  • VB.Net - Overview
  • VB.Net - Environment Setup
  • VB.Net - Program Structure
  • VB.Net - Basic Syntax
  • VB.Net - Data Types
  • VB.Net - Variables
  • VB.Net - Constants
  • VB.Net - Modifiers
  • VB.Net - Statements
  • VB.Net - Directives
  • VB.Net - Operators
  • VB.Net - Decision Making
  • VB.Net - Loops
  • VB.Net - Strings
  • VB.Net - Date & Time
  • VB.Net - Arrays
  • VB.Net - Collections
  • VB.Net - Functions
  • VB.Net - Subs
  • VB.Net - Classes & Objects
  • VB.Net - Exception Handling
  • VB.Net - File Handling
  • VB.Net - Basic Controls
  • VB.Net - Dialog Boxes
  • VB.Net - Advanced Forms
  • VB.Net - Event Handling
  • VB.Net Advanced Tutorial
  • VB.Net - Regular Expressions
  • VB.Net - Database Access
  • VB.Net - Excel Sheet
  • VB.Net - Send Email
  • VB.Net - XML Processing
  • VB.Net - Web Programming
  • VB.Net Useful Resources
  • VB.Net - Quick Guide
  • VB.Net - Useful Resources
  • VB.Net - Discussion
  • Selected Reading
  • UPSC IAS Exams Notes
  • Developer's Best Practices
  • Questions and Answers
  • Effective Resume Writing
  • HR Interview Questions
  • Computer Glossary

VB.Net - Assignment Operators

There are following assignment operators supported by VB.Net −

Try the following example to understand all the assignment operators available in VB.Net −

When the above code is compiled and executed, it produces the following result −

To Continue Learning Please Login

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Logical and Bitwise Operators in Visual Basic

  • 10 contributors

Logical operators compare Boolean expressions and return a Boolean result. The And , Or , AndAlso , OrElse , and Xor operators are binary because they take two operands, while the Not operator is unary because it takes a single operand. Some of these operators can also perform bitwise logical operations on integral values.

Unary Logical Operator

The Not Operator performs logical negation on a Boolean expression. It yields the logical opposite of its operand. If the expression evaluates to True , then Not returns False ; if the expression evaluates to False , then Not returns True . The following example illustrates this.

Binary Logical Operators

The And Operator performs logical conjunction on two Boolean expressions. If both expressions evaluate to True , then And returns True . If at least one of the expressions evaluates to False , then And returns False .

The Or Operator performs logical disjunction or inclusion on two Boolean expressions. If either expression evaluates to True , or both evaluate to True , then Or returns True . If neither expression evaluates to True , Or returns False .

The Xor Operator performs logical exclusion on two Boolean expressions. If exactly one expression evaluates to True , but not both, Xor returns True . If both expressions evaluate to True or both evaluate to False , Xor returns False .

The following example illustrates the And , Or , and Xor operators.

Short-Circuiting Logical Operations

The AndAlso Operator is very similar to the And operator, in that it also performs logical conjunction on two Boolean expressions. The key difference between the two is that AndAlso exhibits short-circuiting behavior. If the first expression in an AndAlso expression evaluates to False , then the second expression is not evaluated because it cannot alter the final result, and AndAlso returns False .

Similarly, the OrElse Operator performs short-circuiting logical disjunction on two Boolean expressions. If the first expression in an OrElse expression evaluates to True , then the second expression is not evaluated because it cannot alter the final result, and OrElse returns True .

Short-Circuiting Trade-Offs

Short-circuiting can improve performance by not evaluating an expression that cannot alter the result of the logical operation. However, if that expression performs additional actions, short-circuiting skips those actions. For example, if the expression includes a call to a Function procedure, that procedure is not called if the expression is short-circuited, and any additional code contained in the Function does not run. Therefore, the function might run only occasionally, and might not be tested correctly. Or the program logic might depend on the code in the Function .

The following example illustrates the difference between And , Or , and their short-circuiting counterparts.

In the preceding example, note that some important code inside checkIfValid() does not run when the call is short-circuited. The first If statement calls checkIfValid() even though 12 > 45 returns False , because And does not short-circuit. The second If statement does not call checkIfValid() , because when 12 > 45 returns False , AndAlso short-circuits the second expression. The third If statement calls checkIfValid() even though 12 < 45 returns True , because Or does not short-circuit. The fourth If statement does not call checkIfValid() , because when 12 < 45 returns True , OrElse short-circuits the second expression.

Bitwise Operations

Bitwise operations evaluate two integral values in binary (base 2) form. They compare the bits at corresponding positions and then assign values based on the comparison. The following example illustrates the And operator.

The preceding example sets the value of x to 1. This happens for the following reasons:

The values are treated as binary:

3 in binary form = 011

5 in binary form = 101

The And operator compares the binary representations, one binary position (bit) at a time. If both bits at a given position are 1, then a 1 is placed in that position in the result. If either bit is 0, then a 0 is placed in that position in the result. In the preceding example this works out as follows:

011 (3 in binary form)

101 (5 in binary form)

001 (The result, in binary form)

The result is treated as decimal. The value 001 is the binary representation of 1, so x = 1.

The bitwise Or operation is similar, except that a 1 is assigned to the result bit if either or both of the compared bits is 1. Xor assigns a 1 to the result bit if exactly one of the compared bits (not both) is 1. Not takes a single operand and inverts all the bits, including the sign bit, and assigns that value to the result. This means that for signed positive numbers, Not always returns a negative value, and for negative numbers, Not always returns a positive or zero value.

The AndAlso and OrElse operators do not support bitwise operations.

Bitwise operations can be performed on integral types only. Floating-point values must be converted to integral types before bitwise operation can proceed.

  • Logical/Bitwise Operators (Visual Basic)
  • Boolean Expressions
  • Arithmetic Operators in Visual Basic
  • Comparison Operators in Visual Basic
  • Concatenation Operators in Visual Basic
  • Efficient Combination of Operators

Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback .

Submit and view feedback for

Additional resources

Log in using your username and password

  • Search More Search for this keyword Advanced search
  • Latest Content
  • For authors
  • BMJ Journals More You are viewing from: Google Indexer

You are here

  • Volume 10, Issue 2
  • Traditional versus progressive robot-assisted gait training in people with multiple sclerosis and severe gait disability: study protocol for the PROGR-EX randomised controlled trial
  • Article Text
  • Article info
  • Citation Tools
  • Rapid Responses
  • Article metrics

Download PDF

  • http://orcid.org/0000-0002-8681-3090 Andrea Baroni 1 , 2 ,
  • Nicola Lamberti 1 , 2 ,
  • Marialuisa Gandolfi 3 ,
  • Michela Rimondini 3 ,
  • Valeria Bertagnolo 4 ,
  • Silvia Grassilli 5 ,
  • Luigi Zerbinati 1 , 2 ,
  • Fabio Manfredini 1 , 2 ,
  • Sofia Straudi 1 , 2
  • 1 Department of Neuroscience and Rehabilitation , Ferrara University , Ferrara , Italy
  • 2 Department of Neuroscience , Ferrara University Hospital , Ferrara , Italy
  • 3 Department of Neurosciences, Biomedicine and Movement Sciences , Verona University , Verona , Italy
  • 4 Department of Translational Medicine , Ferrara University , Ferrara , Italy
  • 5 Department of Environment and Prevention Sciences , Ferrara University , Ferrara , Italy
  • Correspondence to Professor Fabio Manfredini; fabio.manfredini{at}unife.it

Gait disorders are the most frequent symptoms associated to multiple sclerosis (MS). Robot-assisted gait training (RAGT) in people with MS (PwMS) has been proposed as a possible effective treatment option for severe motor disability without significant superiority when compared to intensive overground gait training (OGT). Furthermore, RAGT at high intensity may enhance fatigue and spasticity. This study aims to evaluate the effects of a low-intensity RAGT at progressively increasing intensity compared to conventional RAGT and OGT in PwMS and moderate to severe walking impairment. 24 PwMS will be recruited and assigned to one of the three treatment groups: low-intensity RAGT at progressively increasing intensity, conventional RAGT and OGT. All participants will receive 3-weekly treatment sessions of 3 hours each for 4 weeks. In the first 2 hours of treatment, all participants will receive a rehabilitation programme based on stretching exercises, muscle strengthening and educational interventions. During the last hour, subjects will undergo specific gait training according to the assignment group. Outcomes will be assessed before and after treatment and at 3-month follow-up. The primary outcome is walking speed. Secondary outcomes include mobility and balance, psychological measures, muscle oxygen consumption, electrical and haemodynamic brain activity, urinary biomarkers, usability, and acceptability of robotic devices for motor rehabilitation. The results of this study will provide a safe, affordable and non-operator-dependent, intervention for PwMS. Results in terms of functional, psychological, neurophysiological and biological outcomes will confirm our hypothesis. The study’s trial registration number: NCT06381440 .

  • Rehabilitation
  • Neurological rehabilitation

Data availability statement

No data are available.

This is an open access article distributed in accordance with the Creative Commons Attribution 4.0 Unported (CC BY 4.0) license, which permits others to copy, redistribute, remix, transform and build upon this work for any purpose, provided the original work is properly cited, a link to the licence is given, and indication of whether changes were made. See:  https://creativecommons.org/licenses/by/4.0/ .

https://doi.org/10.1136/bmjsem-2024-002039

Statistics from Altmetric.com

Request permissions.

If you wish to reuse any or all of this article please use the link below which will take you to the Copyright Clearance Center’s RightsLink service. You will be able to get a quick price and instant permission to reuse the content in many different ways.

WHAT IS ALREADY KNOWN ON THIS TOPIC

Gait disorders are frequent in people with multiple sclerosis (PwMS) frequently associated with a progressive decline in cardiorespiratory fitness. Robot-assisted gait training (RAGT) represents an effective treatment option, allowing the reproduction of physiological gait patterns. Different combinations of gait parameters within the rehabilitative intervention may result in various degrees of metabolic engagement and disability reduction.

WHAT THIS STUDY ADDS

The PROGR-EX study aims to investigate whether the variability of response to RAGT in PwMS might be related to the imposed load factors and the consequent metabolic response. It explores the response to low-intensity RAGT at progressively increasing intensity regarding functional, psychological, neurophysiological and biological outcomes.

HOW THIS STUDY MIGHT AFFECT RESEARCH, PRACTICE OR POLICY

The PROGR-EX study would optimise using RAGT in future research studies and clinical practice, identifying a non-operator-dependent intervention model. Identifying the optimal dose response could help treat PwMS, where fatigue management must be considered in the definition of the rehabilitation intervention.

Introduction

Multiple sclerosis (MS) is a demyelinating neurodegenerative disease involving the central nervous system through a chronic autoimmune inflammatory process, 1 affecting 2.9 million people worldwide in 2023. 2 Gait disorders are the most frequent symptoms, and it is estimated that approximately 50% of patients require walking assistance within 15 years from symptom onset. 3 The high prevalence of motor dysfunction and gait disability in people with MS (PwMS) is often associated with a progressive decline in cardiorespiratory fitness, placing them at increased risk of cardiovascular events. 4 5

The approaches focusing on gait rehabilitation help reduce the patient’s disability and improve activity and independence. 6 The use of robotic devices for gait rehabilitation has been widely documented in neurological disorders, 7–10 and robot-assisted gait training (RAGT) in PwMS has been proposed as a possible effective treatment option for severe motor disability to address the specific impairments of gait and balance disorders in MS. 11 12 Robotic devices such as walking exoskeletons make it possible to support movements involved in walking, reproducing physiological gait patterns, prolonging the reproduction of task-specific motor skills and reducing the therapist’s physical exertion. Different combinations of gait parameters within the rehabilitative intervention could bring different degrees of metabolic engagement and result in disability reduction. These aspects could be relevant where RAGT continues to prove effective in increasing patient mobility, 12 13 but without showing significant superiority compared with intensive overground gait rehabilitation, 14 associated with a wide interindividual response variability.

Straudi et al analysed the individual determinants of the imposed load in a sample of PwMS. 14 The exercise intensity was calculated considering the average training speed of the patients’ basal speed, which was measured with a walking test to obtain an objective parameter for the internal load imposed on the patients. The results showed a great variability for the RAGT group, with a range of relative exercise intensity between 11% and 114%. The comparison between the relative intensity of training and functional outcomes showed that in the RAGT group, there was a significant inverse relationship between the relative intensity of exercise and the increase in walking speed at the end of rehabilitation. Furthermore, considering a minimal clinically important difference for walking speed set at 20%, Straudi et al observed that most of the responders were PwMS that walked slower at the pretreatment assessment. 14 Benefits of low-intensity training at progressively increasing intensity have also been observed in PwMS when empowered by blood flow restriction, 15 muscular and haemodynamic responses in diseases such as peripheral arterial disease, 16–18 stroke 19 20 and dialysis patients. 21–23

From a neurological point of view, there is limited information regarding the mechanisms of cerebral reorganisation after gait rehabilitation using RAGT. Several non-invasive methods can be used to assess the impact of rehabilitation on neuroplasticity, including functional near-infrared spectroscopy (fNIRS) and electroencephalography (EEG). The fNIRS investigation evaluates the degree of cortical activation by measuring cerebral oxygenation 24 ; the EEG evaluates brain activation by detecting cortical electrical activity. 25 Both techniques present some limitations, but integrating fNIRS and EEG could help overcome the weakness of the single method.

From a biomolecular point of view, identifying a biomarker of MS progression and response to rehabilitation treatment represents a critical point in managing the disease. 26 microRNAs (miRNAs) have been found in various body fluids, including plasma, cerebrospinal fluid, urine and saliva. It is a small non-coding RNAs that regulate mRNA stability, controlling gene expression. 27 Changes in their expression have been associated with the development and progression of numerous diseases, suggesting potential clinical applications in MS. 27 As urine is an extracellular human body fluid obtained in large volumes using simple, non-invasive methods, urinary miRNAs may represent reliable biomarkers of MS progression and response to rehabilitation treatment.

Finally, the patient’s perception of different rehabilitative approaches represents a strong motivational drive in the successful treatment outcome. Therefore, the usability and acceptability of robotic devices for motor rehabilitation must be evaluated.

Aims of the study

The study’s primary aim is to test whether the variability of response to RAGT in PwMS might be related to the imposed load factors and the consequent metabolic response.

The secondary aims are to investigate MS progression and response to rehabilitation treatment through the study of urinary miRNA and to collect information about the usability, acceptability and perceived pleasantness of new rehabilitative technologies in gait training from the patient’s perspective.

Study design and setting

This is a three-group parallel-assignment pilot, double-blinded, randomised control trial. PwMS who meet the inclusion criteria and provide written informed consent will be assigned to one of the three treatment groups: the low-intensity RAGT at progressively increasing intensity group, the conventional RAGT group or the overground training (OGT) group.

The protocol of this clinical trial is reported following the Standard Protocol Items: Recommendations for Interventional Trials (SPIRIT) guidelines. 28 A SPIRIT checklist is available as online supplemental material . Subjects will be recruited from the patients afferent to the Outpatient Rehabilitation Clinic at the University Hospital of Ferrara. Enrolment began on 15 November 2023 and is expected to continue until December 2024. Final data are expected to be collected in March 2025, and the study results will be published in about 6 months.

Supplemental material

Selection criteria and recruitment of participants.

PwMS will be included if they meet the following inclusion criteria: (a) men and women between 18 and 65 years; (b) diagnosis of MS (primary or secondary progressive) without relapses in the preceding 3 months; (c) disability rate defined by Expanded Disability Status Scale score from 6 to 7 29 ; (d) ability to perform the Timed 25-Foot Walk (T25-FW) test 30 and (e) Mini-Mental Status Examination score ≥24/30. 31

PwMS will be excluded if they have (a) other (neurological) conditions that may affect motor function; (b) medical conditions might interfere with the ability to complete the study protocol safely; (c) the presence of spasticity with a modified Ashworth Scale (MAS) score >3 or retractions limiting the range of motion of the hip, knee or ankle; (d) MS relapses or medication changes, or any other confounding factors during the study period and (e) rehabilitation treatment or botulinum toxin injection in the 3 months preceding the start of the study.

During the first appointment, potential participants will be informed about all the study procedures and screened following the inclusion criteria. If the inclusion criteria are met, potential participants will be given a study information leaflet detailing the study’s objectives, procedures, time frame, risks and potential benefits, as well as the telephone contact details of the staff involved and the Consent Form. A copy of the Consent Form is available as online supplemental material . In the following 3 days, candidates will be contacted by telephone and asked about their decision. For those who decide to participate, an appointment will be scheduled at which signed informed consent will be requested, and a physiotherapist will perform baseline assessments. The total number of subjects screened will be recorded according to the Consolidated Standards of Reporting Trials guidelines ( figure 1 ).

  • Download figure
  • Open in new tab
  • Download powerpoint

Consolidated Standards of Reporting Trials flow diagram of the study. OGT, overground training; RAGT, robot-assisted gait training.

Randomisation and blinding

An external administrator will generate and manage the randomisation list, created with the online application available at www.randomization.com . Subjects enrolled will be assigned to one of the three treatment groups through a block randomisation approach. The outcome assessor will be blinded to the subject’s group assignment. All outcome data and group assignments will be organised in separate datasets to maintain blindness during data analysis.

Intervention

All participants will receive 3-weekly treatment sessions of 3 hours each for 4 weeks and 12 sessions. Patients who miss more than three rehabilitation sessions will be excluded from the study.

In the first 2 hours of treatment, an experienced physiotherapist will propose a programme based on stretching exercises, muscle strengthening and educational interventions. According to the assignment group, subjects will undergo specific gait training during the last hour. The different kinds of walking treatment are graphically represented in figure 2 . All interventions will be delivered at the Rehabilitation Clinic of the University Hospital of Ferrara.

Graphical representation of the different kinds of walking treatment. OGT, overground training; RAGT, robot-assisted gait training; t, time; v, velocity.

Low-intensity RAGT at progressively increasing intensity

Subjects allocated to this group will receive gait rehabilitation on the Lokomat device (Hocoma AG, Volketswil, Switzerland). During the session, subjects will wear a harness connected to a body weight support system and walk on a treadmill guided by an exoskeleton according to a physiological movement pattern. The device will be set at 60% robotic assistance, 50% load suspension and a speed initially set at 1.0 km/hour, with progressive increments of 0.1 km/hour at each training session. The working time consists of bouts of 3 min of work alternated by 1 min of recovery, to be repeated eight times.

Conventional RAGT

Subjects allocated to this group will receive gait rehabilitation on the Lokomat device (Hocoma AG, Volketswil, Switzerland) as the previous treatment group. In this case, the parameters for setting up the machine will be determined by the physiotherapist administering the patient’s specific characteristics. The effective treatment duration will be 30 min, considering a preparation time for the patient on the machine of approximately 30 min.

Overground training

Subjects allocated to this group will receive a 1-hour walking training session supervised by a physiotherapist. During this time, the subject will perform a 40 min walk on a flat surface, preceded by a warm-up phase and a 10 min warm-down phase each. Subjects will walk back and forth approximately 30 m using their walking aid. If necessary, patients will benefit from recovery breaks, followed by resumption of exercise.

At the end of the treatment, the total distance walked, as well as the effective walking time, will be recorded on a special form.

Concomitant care and recommendations

All patients receiving treatment will be asked to avoid other simultaneous physiotherapy treatments for the duration of the study until follow-up.

Fidelity to treatment and adverse events monitoring

To guarantee that an experienced research group member will train in the most accurate intervention, the physiotherapists involved in using the Lokomat and conventional gait will be tested, and their abilities will be tested.

At the beginning of the study, each physiotherapist will be provided with a form for recording the intervention specifications. Any unpredictable adverse event will be recorded in each patient’s registry and the study’s electronic database and managed according to the hospital’s policies, with referral for appropriate medical follow-up.

Outcome assessment and data collection

The same physiotherapist will record all outcome measures at the Operative Unit of Physical and Rehabilitation Medicine of Ferrara University Hospital, blinded to the randomisation list. Clinical and instrumental evaluation will be performed before (T0) and after (T1) the twelve sessions of treatment and at 3-month follow-up (T2).

A clinical psychologist with expertise in MS from the Department of Neuroscience, Biomedicine and Movement Sciences at the University of Verona will remotely assess the robot technology’s usability, acceptability and perceived pleasantness. The assessor will be blinded to the patient allocation group, and the evaluation will be performed only at T1.

A team member will record each participant’s general demographic information, including age and gender, as well as their comorbidities and medical history ( table 1 ).

  • View inline

Schedule of enrolment, interventions and assessment

Primary outcome: walking function

The T25-FW test will be the primary outcome as a relevant indicator of current and future disability, 30 a component of the MS functional composite. 32 The patient will be instructed to walk 25 ft as fast as possible but safely, and the time will be recorded.

Secondary outcome measures

Secondary outcomes will include clinical measures and questionnaires, psychological assessment, haemodynamic and metabolic evaluations, brain activity, laboratory-based measures and patient feedback on the robot-assisted intervention’s usability, acceptability and perceived pleasantness.

Clinical measures and questionnaires

Timed Up and Go test: A reliable measure of functional mobility. 33 The task requires the patient to stand up from a chair, walk 3 m, cross a marked line on the floor, turn around, walk back to the chair and sit down. The time taken to complete the task is recorded using a stopwatch.

6 min Walk Test: A reliable measure of walking endurance. 34 Subjects will be instructed to walk as quickly and safely as possible for 6 min, with the option to slow down and rest if necessary. The total distance walked will be recorded.

Berg Balance Scale: A 5-point ordinal scale used to assess the ability to maintain balance statically and during functional movements, 35 widely used in PwMS. 36

Modified Ashworth Scale: A 6-point measure of spasticity performed at the flexor and extensor muscles of the hip, knee and ankle. 37

Multiple Sclerosis Impact Scale-29: A questionnaire that evaluates the impact of MS on physical and psychological functioning. It comprises 29 items, with 20 items assessing physical activity and 9 assessing psychological state. 38

Multiple Sclerosis Walking Scale-12: A questionnaire used to evaluate the impact of MS on walking ability. It comprises 12 items that inquire about the patient’s perception of gait speed, running, confidence in ascending/descending stairs, balance and fatigue. 39

Fatigue Severity Scale: A short questionnaire that requires the subject to rate their level of fatigue from 1 to 7. 40

Psychological assessment

Beck Anxiety Inventory: A questionnaire used to measure anxiety levels, consisting of 21 items. 41

Beck Depression Inventory II: A questionnaire comprised 21 multiple-choice questions which serve as a self-assessment tool designed to gauge the intensity of depression. 42

Tampa Scale for Kinesiophobia: A 17-item self-evaluation checklist on a 4-point Likert scale to assess the fear of movement or potential reinjury. 43

Psychosocial Adjustment to Illness Scale-Self Report consists of a 46-item self-report tool with multiple domains designed to evaluate a patient’s adaptation to a current medical condition or the aftermath of a past illness. 44

Brief Coping Orientation to Problems Experienced: A self-report questionnaire used to evaluate coping strategies in facing stressful, unpredictable and damaging events. 45

Haemodynamic and metabolic evaluations

The NIRS technology will evaluate muscle oxygen consumption. The patient, lying supine, will be fitted with a pair of NIRS sensors (transmitter and receiver) at the medial belly of the gastrocnemius to monitor changes in oxygenated and deoxygenated haemoglobin. Subsequently, a slight compression (60 mm Hg) is applied using a sleeve to the thigh. The rate of increase in deoxygenated haemoglobin during the 30 s of compression will be used to calculate the local muscle oxygen consumption value for both lower limbs. 46 47

Haemodynamic cortical activation: Recorded during reaching and grasping activities performed with the most impaired (or not dominant) upper limb. An analysis model was developed to quantify the variations in oxygenation that occurred during the motor task of reaching and grasping for the hemiparetic arm, as proposed by Kato et al . 48 Each patient will be equipped with an NIRS system (NIRScout, NIRx Medical Technologies, Glen Head, New York, USA) composed of 16 sources and 16 detectors emitting two wavelengths of near-infrared light (760 and 850 nm). Haemodynamic signals will be recorded at a sampling rate of 3.81 Hz. A standard cap will be placed over each participant’s scalp, and sources and detectors will be positioned on the measuring cap according to the 10–20 international system with standard interoptode distances of approximately 3 cm. Optodes were placed over both hemispheres, resulting in 48 channels covering the regions of the primary motor and sensorimotor cortices. After collection, data will be analysed using NIRSlab software (V.2017.6, NIRx Medical Technologies, Glen Head, New York, USA), assessing the variations in oxygenated and deoxygenated haemoglobin. 49

Electrical brain activity

EEG recording during action observation task: Subjects will be seated at 90 cm from a PC monitor. The stimulus presentation will be performed using E-Prime V.2.0 software. 50 Stimuli will consist of videos filmed in the first person, in which a hand will show reaching for and grasping a can. The choice to show the right or left limb performing movement will be tailored for each participant depending on the more impaired (or not dominant) upper limb. The EEG will be recorded during the 20 min of the session: 3 min with open eyes, 3 min with closed eyes and 14 min of video observation. Further details about EEG recording procedures are described by Antonioni et al . 51

During a common motor task, haemodynamic cortical activation and electrical brain activity will be recorded to pair fNIRS and EEG signals. While sitting on a standard chair with both arms on a fixed table, each patient will be instructed to perform the motor task of reaching and grasping with the more impaired arm, which will be repeated thrice. The task will last approximately 10 s and be spaced out by 10 s of rest and repeated 20 times. E-Prime software will send triggers of the video’s start and end so the signal can be correctly epoch later.

Laboratory-based measures

Exosomes purification from urine. Urine (20–50 mL) of patients at T0 and T1 will be collected in the morning and stored at 4°C until purification of urinary exosomes (uEVs) after the addition of protease inhibitors. Urine samples from each patient will be centrifuged at 2000×g for 30 min at 4°C to remove cells, cellular debris, bacteria and apoptotic bodies, then at 17 000×g at 4°C for 60 min to remove remaining macropolymers and large extracellular vesicles. The supernatant will then be subjected to ultracentrifugation at 200 000×g for 60 min at 4°C. The resulting pellet, corresponding to the exosomal fraction, will be resuspended in 250 µL of PBS and stored at −80°C. 52

Analysis of miRNA expression in urinary exosomes: Total RNA will be extracted from uEVs using the miRNeasy Micro Kit (Qiagen, Hilden, Germany) following procedures previously described in the literature. 53 54 Reverse transcription to cDNA will be performed using the miRCURY LNA RT Kit (Qiagen). According to the manufacturer’s instructions, the ‘Urine Exosome Focus miRNA’ PCR panel (Qiagen) will be used for miRNA profiling. The panel allows the analysis of the expression of 87 urinary miRNAs, variably correlated with neurogenesis, activity of nerve cells and/or cardiovascular system. The panel also includes five miRNAs to be used as normalisers for calculating the expression levels of exosomal miRNAs using the 2 −∆∆Ct method.

Acceptability of robot intervention

At T1, we will administer an ad hoc questionnaire with closed 1–10 Likert scale and open-ended questions to assess patients’ experience with the robot intervention. The questionnaire will specifically explore the robotic intervention’s usability, acceptability, perceived pleasantness and safety.

Data management

Clinical and instrumental data will be analysed by a blinded statistician using the following software packages: Medcalc Software (MedCalc Software bvba, Ostend, Belgium), IBM-SPSS Statistics (IBM, Armonk, USA) and Stata Statistical Software (Release V.13., StataCorp).

Sample size calculation

As this is a pilot study, the sample size does not need to be calculated. 55 The sample planned for this preliminary study comprises 24 subjects, 8 in each intervention group.

Statistical analysis

Descriptive statistics (mean and 95% CI) will be reported at T0, T1 and T2 for all the variables. The distribution of data at baseline will be tested using the Shapiro-Francia tests. The baseline comparison between the three groups will be performed using the χ 2 test for categorical variables and one-way analysis of variance (ANOVA) or the Kruskal-Wallis test for continuous variables, as appropriate. The outcome comparison between the three groups will be performed using a one-way ANOVA or Kruskal-Wallis test according to sample distribution. The intragroup comparison between T0, T1 and T2 will be performed using a t-test for paired data or a Wilcoxon test, depending on the distribution. In case of imbalances at baseline between the groups, appropriate statistical correction analyses (eg, analysis of covariance) will be adopted. Patient perspectives on the acceptability and usability of the robot intervention will be analysed using descriptive analysis for quantitative and inductive content analysis for qualitative data. 56

Intention to treat

The data will be analysed according to intention to treat, although a subsequent per-protocol analysis will be carried out to check the stability of the conclusions. The multiple imputation procedure will be carried out in case of missing data.

Data monitoring and interim analysis

The study does not have a data monitoring committee. The research coordinator will conduct an interim analysis every 6 months to determine whether the study should be stopped, modified or continued. Any subsequent changes will be discussed by the research team and communicated to the funding agency and the ethics committee.

This pilot randomised controlled trial aimed to investigate the efficacy of robot-assisted gait rehabilitation in PwMS by identifying the robotic intervention’s loading factors, related metabolic response and the patient’s perspective. Identifying these non-operator-dependent intervention models would optimise the use of RAGT in future research studies and clinical practice.

We expect this study to observe an improvement in gait, mobility and balance in all patients, both those who received robot-assisted gait rehabilitation and those who received OGT. However, considering the results of increasing training intensity in other populations, 16 19 23 we expect significantly greater changes in subjects assigned to the low-intensity RAGT at progressively increasing intensity group than in the other treatment groups.

Identifying the optimal dose response could be useful in PwMS, where fatigue management must be considered when defining the rehabilitation intervention and its parameters. The novelty of the intervention we will apply lies in proposing a low-intensity intervention and gradually increasing its intensity throughout the treatment sessions. This approach seems in contrast to literature recommendations regarding exercise characteristics that must be intense and high doses to promote learning mechanisms and neuroplasticity. 57 58 The idea that more is better may not be suitable for a patient in whom symptoms like fatigue and spasticity caused by high-intensity training may compromise the effectiveness and applicability of the intervention, particularly in patients with a high disability level. Furthermore, implementing a low-intensity protocol would broaden the range of PwMS who can benefit from robotic gait therapy.

Concerning exosomal urinary miRNAs, we expect to identify one or more miRNA correlated with MS to confirm that urine is a useful body fluid for detecting molecules related to this pathology. We also expect to be able to establish one or more miRNA panels to be used as diagnostic/prognostic biomarkers of the effects of treatments, regardless of the intervention.

Psychiatric comorbidities represent a challenge when treating patients with PwMS due to the high prevalence of these disorders and the limited evidence for the efficacy of pharmacological treatments. 59 On the other hand, there is emerging evidence about the effectiveness of rehabilitation programmes on mood symptoms in MS patients. 60 Consequently, we anticipate that participation in rehabilitation treatments will yield positive outcomes for all patients, irrespective of their group allocation. However, variations in the exercises’ content across the three groups, particularly in intensity, are expected to elicit distinct experiences, perceptions and emotional responses from the patients, contingent on the nature of their assigned intervention.

We assume that both quantitative and qualitative data on the usability and acceptability of the robotic intervention will provide valuable insights into the patient’s ‘lived experience’. 61 Qualitatively exploring the unique perspectives of PwMS and severe gait disability and collecting their suggestions regarding possible barriers and strategies for participation might inform future intervention implementation. 62 Since RAGT is safe and well tolerated by patients with MS, 63 we expect patients to provide positive feedback on the robotic intervention.

Our study may have some limitations. First, the pilot nature of the study does not allow any definitive conclusions due to the low number of subjects recruited. Second, the absence of a follow-up evaluation of more than 3 months does not allow us to conclude the effectiveness of the low-intensity intervention at progressively increasing intensity over time.

If the pilot study’s findings confirm our hypothesis, a randomised trial on a larger group of subjects would allow us to confirm our results.

Ethics statements

Patient consent for publication.

Not applicable.

Ethics approval

The PROGR-EX study protocol was approved by the local ethical committee in July 2023 (Comitato Etico di Area Vasta Emilia Centro, CE-AVEC, protocol code: EM417-2023_845/2019/Sper/AOUFe_EM1). Participants gave informed consent to participate in the study before taking part. The privacy of the participants and their medical records will be guaranteed by treating the data according to the Italian Law n. 196/2003, the ‘Safe Harbor Act’ (2000/520/CE), and the ‘European Union Data Protection Directive (95/46/EC 24 October 1995)’.

Acknowledgments

The authors would like to thank Giulia Fregna, Gabriele Perachiotti, Anna Crepaldi, Giovanni Piva, Isolde Martina Busch and Valeria Donisi for their help in data collection and patient management.

  • Gunzler DD ,
  • De Nadai AS ,
  • Miller DM , et al
  • Rechtman L , et al
  • Langeskov-Christensen M , et al
  • Paolucci S ,
  • Cherubini A , et al
  • Alashram AR ,
  • O’Brien A ,
  • Adans-Dester C ,
  • Scarton A , et al
  • Carmignano SM ,
  • Fundarò C ,
  • Bonaiuti D , et al
  • Gandolfi M ,
  • Picelli A , et al
  • Calabrò RS ,
  • Mazzoli D , et al
  • Straudi S ,
  • Fanciullacci C ,
  • Martinuzzi C , et al
  • Manfredini F ,
  • Lamberti N , et al
  • Lamberti N ,
  • Donadi M , et al
  • Malagoni AM ,
  • Mascoli F , et al
  • Mandini S , et al
  • Ficarra V , et al
  • Cavazza S ,
  • Ferraresi G , et al
  • Malagoni AM , et al
  • Mallamaci F ,
  • D’Arrigo G , et al
  • Catizone L ,
  • Baggetta R ,
  • D’Arrigo G ,
  • Torino C , et al
  • Baroni A , et al
  • Müller S , et al
  • Rosenkranz SC ,
  • Ploughman M ,
  • Hvid LG , et al
  • Pérez MMG ,
  • Tetzlaff JM ,
  • Gøtzsche PC , et al
  • Kalinowski A ,
  • Bozinov N , et al
  • Beatty WW ,
  • Fischer JS ,
  • Rudick RA ,
  • Cutter GR , et al
  • Goldman MD ,
  • Marrie RA ,
  • Wood-Dauphinee SL ,
  • Williams JI , et al
  • Cattaneo D ,
  • Bohannon RW ,
  • Lamping D ,
  • Fitzpatrick R , et al
  • Marengo D ,
  • Gamberini G , et al
  • Ottonello M ,
  • Pellicciari L ,
  • Giordano A , et al
  • Epstein N ,
  • Brown G , et al
  • Monticone M ,
  • Baiardi P , et al
  • Derogatis LR
  • Bongelli R ,
  • Fermani A ,
  • Canestrari C , et al
  • Felisatti M ,
  • Izumiyama M ,
  • Koizumi H , et al
  • Nardi F , et al
  • Schneider W ,
  • Eschman A ,
  • Zuccolotto A
  • Antonioni A ,
  • Galluccio M ,
  • Wang J , et al
  • Levstek T ,
  • Vujkovac B ,
  • Cokan Vujkovac A , et al
  • Grassilli S ,
  • Vezzali F ,
  • Cairo S , et al
  • Thabane L ,
  • Chu R , et al
  • Moretti F ,
  • van Vliet L ,
  • Bensing J , et al
  • Galea MP , et al
  • Markevics S ,
  • Haas B , et al
  • Sandroff BM
  • Kyriakatis GM ,
  • Thompson C ,
  • Mazzi MA , et al
  • Tam K-W , et al

Supplementary materials

Supplementary data.

This web only file has been produced by the BMJ Publishing Group from an electronic file supplied by the author(s) and has not been edited for content.

  • Data supplement 1

Contributors Study conception and design: AB, NL, FM and SS. Data collection: AB, NL, MR, SG and LZ. Writing–original draft preparation: AB and NL. Writing–review and editing: MG, FM and SS. Supervision: MG, VB, FM and SS. Project administration: AB, NL, FM and SS. Funding acquisition: FM. All authors read and agreed to the published version of the manuscript.

Funding This work was supported by #NEXTGENERATIONEU (NGEU), funded by the Ministry of University and Research (MUR), National Recovery and Resilience Plan (NRRP), project MNESYS (PE0000006)—A Multiscale integrated approach to the study of the nervous system in health and disease (DN. 1553 11.10.2022).

Competing interests None declared.

Patient and public involvement Patients and/or the public were involved in the design, or conduct, or reporting, or dissemination plans of this research. Refer to the Methods section for further details.

Provenance and peer review Not commissioned; externally peer reviewed.

Supplemental material This content has been supplied by the author(s). It has not been vetted by BMJ Publishing Group Limited (BMJ) and may not have been peer-reviewed. Any opinions or recommendations discussed are solely those of the author(s) and are not endorsed by BMJ. BMJ disclaims all liability and responsibility arising from any reliance placed on the content. Where the content includes any translated material, BMJ does not warrant the accuracy and reliability of the translations (including but not limited to local regulations, clinical guidelines, terminology, drug names and drug dosages), and is not responsible for any error and/or omissions arising from translation and adaptation or otherwise.

Read the full text or download the PDF:

Artículos, tutoriales, trucos, curiosidades, reflexiones y links sobre programación web ASP.NET Core, MVC, Blazor, SignalR, Entity Framework, C#, Azure, Javascript... y lo que venga ;)

Archivo del blog.

  • Un ejemplo de uso elegante del operador "null coal...
  • Enlaces interesantes 569
  • ¡No uses ContainsKey() en un diccionario .NET para...
  • Enlaces interesantes 568
  • ¡Variable not found cumple 18 años!
  • Enlaces interesantes 567
  • ► abril (9)
  • ► marzo (7)
  • ► febrero (7)
  • ► enero (6)
  • ► diciembre (6)
  • ► noviembre (7)
  • ► octubre (7)
  • ► septiembre (3)
  • ► julio (5)
  • ► junio (8)
  • ► mayo (7)
  • ► abril (6)
  • ► marzo (8)
  • ► enero (7)
  • ► noviembre (8)
  • ► octubre (8)
  • ► septiembre (4)
  • ► julio (6)
  • ► mayo (9)
  • ► abril (7)
  • ► febrero (8)
  • ► diciembre (7)
  • ► septiembre (5)
  • ► junio (9)
  • ► enero (5)
  • ► septiembre (6)
  • ► julio (4)
  • ► junio (10)
  • ► mayo (8)
  • ► marzo (9)
  • ► diciembre (9)
  • ► octubre (9)
  • ► julio (7)
  • ► abril (8)
  • ► enero (8)
  • ► octubre (6)
  • ► mayo (10)
  • ► marzo (4)
  • ► enero (4)
  • ► diciembre (8)
  • ► mayo (11)
  • ► noviembre (4)
  • ► septiembre (2)
  • ► junio (16)
  • ► mayo (14)
  • ► marzo (6)
  • ► noviembre (5)
  • ► julio (9)
  • ► septiembre (7)
  • ► abril (5)
  • ► septiembre (9)
  • ► julio (8)
  • ► febrero (6)
  • ► diciembre (5)
  • ► noviembre (6)
  • ► octubre (10)
  • ► junio (11)
  • ► febrero (9)
  • ► enero (9)
  • ► diciembre (10)
  • ► noviembre (9)
  • ► septiembre (13)
  • ► mayo (15)
  • ► febrero (11)
  • ► enero (10)
  • ► septiembre (8)
  • ► junio (7)
  • ► abril (10)
  • ► septiembre (10)
  • ► junio (5)
  • ► marzo (2)
  • ► febrero (4)
  • ► noviembre (10)
  • ► agosto (1)
  • ► marzo (10)
  • ► septiembre (15)
  • ► junio (6)
  • ► mayo (6)
  • ► marzo (5)
  • ► febrero (3)
  • ► diciembre (3)
  • ► agosto (2)
  • ► julio (3)

Top semanal

Un ejemplo de uso elegante del operador "null coalescing assignment" de c#.

  • 101 citas célebres del mundo de la informática
  • ¡No uses ContainsKey() en un diccionario .NET para ver si existe un elemento antes de obtenerlo!
  • Pasar variables de script a un Url.Action() o Html.ActionLink()
  • Cómo solucionar el error "Unable to connect to web server 'IIS Express'" en Visual Studio
  • 101 nuevas citas célebres del mundo de la informática (¡y van 404!)
  • Otras 101 citas célebres del mundo de la informática
  • Evitar el postback al pulsar un botón en ASP.Net
  • 10años (11)
  • aniversario (33)
  • antispam (16)
  • asp.net (153)
  • aspnetcore (119)
  • aspnetcoremvc (88)
  • aspnetmvc (179)
  • autobombo (53)
  • blazor (42)
  • blazorserver (28)
  • blazorwasm (28)
  • blogging (70)
  • buenas prácticas (35)
  • componentes (14)
  • consultas (15)
  • curiosidades (42)
  • desarrollo (258)
  • diseño (11)
  • enlaces (535)
  • estándares (13)
  • eventos (25)
  • frikadas (12)
  • google (11)
  • herramientas (30)
  • historias (21)
  • inocentadas (14)
  • javascript (32)
  • jquery (18)
  • microsoft (13)
  • navidad (11)
  • netcore (27)
  • noticias (38)
  • novedades (139)
  • patrones (20)
  • personal (14)
  • programación (107)
  • recomendaciones (11)
  • scripting (11)
  • servicios on-line (37)
  • signalr (17)
  • software libre (11)
  • sorteo (14)
  • sponsored (18)
  • técnicas de spam (12)
  • tecnología (12)
  • trucos (255)
  • vacaciones (22)
  • variablenotfound (31)
  • variablenotfound.com (20)
  • vb.net (26)
  • viajes (12)
  • vs2008 (28)
  • webapi (11)

C#

Revisando código ajeno, me he encontrado con un ejemplo de uso del operador null coalescing assignment de C# que me ha parecido muy elegante y quería compartirlo con vosotros.

Como recordaréis, este operador, introducido en C# 8, es una fórmula muy concisa para asignar un valor a una variable si ésta previamente es null , una mezcla entre el operador de asignación y el null coalescing operator que disfrutamos desde C# 2:

Pero, además, al igual que otras asignaciones, este operador retorna el valor asignado , lo que nos permite encadenar asignaciones y realizar operaciones adicionales en la misma línea.

Por ejemplo, observad el siguiente código:

Aquí, básicamente lo que hacemos es asignar el valor "Hello, World!" a la variable si ésta contiene un nulo, y luego imprimirlo por consola. Y si no es nulo, simplemente se imprime su valor actual.

El código que he me ha llamado la atención sigue más o menos esa línea, y se trataba de un método que debía obtener un valor desde un origen de datos y dejarlo cacheado para llamadas posteriores al mismo. En C# "de toda la vida", más o menos podría ser algo así:

La implementación que me ha parecido muy concisa y elegante es la siguiente:

En una única expresión estamos consiguiendo:

  • Si el valor estaba previamente cacheado, lo retornamos sin hacer nada más.
  • En caso contrario, lo obtenemos desde la fuente de datos y lo almacenamos en la variable _cachedValue , de forma que llamadas posteriores retornarán el valor cacheado.
  • Finalmente, retornamos el valor recién obtenido para que el cliente del método lo reciba.

Bonito, ¿verdad?

Publicado en Variable not found .

Publicado por José M. Aguilar a las 8:05 a. m.  

Etiquetas: c# , trucos

1 comentario:

Sí que lo es :) He utilizado mucho el: var x = GetSomething() ?? GetSomethingElse(); Éste en cambio nunca lo he utilizado. Lo guardo en la caja de herramientas. ¡Gracias!

Enviar un nuevo comentario

¡Nuevo curso!

Variable social.

Suscríbete al RSS

Visitas en los últimos 30 días

IMAGES

  1. PPT

    assignment operators in vbscript

  2. VBScript Tutorial

    assignment operators in vbscript

  3. Vbscript Array

    assignment operators in vbscript

  4. VBScript Operators

    assignment operators in vbscript

  5. VBScript Operators

    assignment operators in vbscript

  6. VBScript Operators

    assignment operators in vbscript

VIDEO

  1. VBScript tutorial

  2. ICT CLASS: How to use Arithmetic Operators in Visual Basic

  3. Assignment operators

  4. 3. "ОСНОВЫ VBA: Условные операторы"

  5. VB Script

  6. C++ Variables, Literals, an Assignment Statements [2]

COMMENTS

  1. Assignment Operators

    The following are the assignment operators defined in Visual Basic. = Operator ^= Operator *= Operator /= Operator \= Operator += Operator-= Operator <<= Operator >>= Operator &= Operator. See also. Operator Precedence in Visual Basic; Operators Listed by Functionality; Statements

  2. VBScript Operators

    In VBScript, operators are used to perform an operation. For example, an operator could be used to assign a value to a variable. An operator could also be used to compare two values. Below is a listing of VBScript operators and a brief description of them. Don't worry if you don't understand all of them at this stage - just bookmark this page ...

  3. VBScript

    The Comparison Operators. There are following comparison operators supported by VBScript language −. Assume variable A holds 10 and variable B holds 20, then −. Show Examples. Operator. Description. Example. =. Checks if the value of two operands are equal or not, if yes then condition becomes true.

  4. = Operator

    The element on the left side of the equal sign ( =) can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly. The = operator assigns the value on its right to the variable or property on its left. The = operator is also used as a comparison operator. For details, see Comparison Operators.

  5. Understanding VBScript: Operators

    As Table 2, page 8, shows, the comparison operators consist of the equality or assignment (=), inequality ... The Like operator is the only operator that VBScript lacks with respect to its parent language, VBA. However, in the sidebar "An Alternative for the Like Operator," page 10, I provide the IsLike function, a VBScript function you can use ...

  6. Assignment Operator (=) (VBScript)

    Assignment Operator (=) (VBScript) See Also. Visual Basic (Declaration) Visual Basic (Usage) C#. C++. J#. JScript. Assigns a value to a variable or property.

  7. VBScript Tutorials

    The above script could be written as follows: <Script Language="VBScript"> Dim Salary Salary = 12.55 Document.Write (Salary); </Script>. The above code declares a variable before assigning it a value. You will usually perform this assignment when you want to change the value held by a variable.

  8. VBScript Language Reference

    Not Operator: Performs logical negation on an expression. Operator Precedence: List showing the order of precedence for various operators used in VBScript. Or Operator: Performs a logical disjunction on two expressions. Subtraction Operator (-) Finds the difference between two numbers or indicates the negative value of a numeric expression. Xor ...

  9. Assignment (=)

    of language. VBScript. Description: Assignment of a value to a variable or property. Syntax: variable = value. Note: The name on the left side of the equal sign can be a simple scalar variable or an array. Properties on the left side of the equal sign can only be those properties that are writable in the running application.

  10. &= Operator

    Remarks. The element on the left side of the &= operator can be a simple scalar variable, a property, or an element of an array. The variable or property cannot be ReadOnly. The &= operator concatenates the String expression on its right to the String variable or property on its left, and assigns the result to the variable or property on its left.

  11. Operator Summary (VBScript)

    Arithmetic Operators. Operators used to perform mathematical calculations. Assignment Operator (=) (VBScript) Operator used to assign a value to a property or variable. Comparison Operators (VBScript) Operators used to perform comparisons. Concatenation Operators. Operators used to combine strings. Logical Operators (VBScript)

  12. VBScript Operators: Logical (AND, OR) Arithmetic, Comparison ...

    The exponentiation operator is equivalent to "the power of" in mathematics. For example, 2^3 is equal to 8. The concatenation operator is used to concatenate two string values. For example, "Hello" & " John" will return "Hello John". VBScript Comparison Operators. Comparison operators are used to compare two values.

  13. What is the order of evaluation of the assignment and equality

    In this situation the = is interpreted as an assignment operator. The remainder of the statement becomes an R-value expression, so all other = operators are interpreted as comparison operators. Ergo is the value of MyThing boolean. VBScript does not support multiple assignments like Python.

  14. Operators list of the VBScript language

    Assignment of a value to a variable or property. Concatenation (&) Used to force string concatenation of two expressions. Division (/) Used to divide two numbers (return a floating-point result) Eqv. Used to perform a logical equivalence on two expressions. Exponentiation (^) Used to raise a number to the power of an exponent.

  15. VBScript Tutorial

    To assist you in making such comparisons, the VBScript language is equipped with special operators that can act on natural numbers, decimal numbers, or strings. Equality = We previously used the assignment operator = to give a value to a variable. Although the assignment operator works on two operands, one on the left and another on the right ...

  16. Assignment Operators in Programming

    Assignment operators are used in programming to assign values to variables. We use an assignment operator to store and update data within a program. They enable programmers to store data in variables and manipulate that data. The most common assignment operator is the equals sign (=), which assigns the value on the right side of the operator to ...

  17. VBScript

    Assignment Operator (=) (VBScript) See Also Assigns a value to a variable or property. variable = value: Arguments. Remarks Requirements. See Also. In Vbsedit, you only need to press F1 to get Help for the keyword under the cursor! ...

  18. Addition (+)

    VBScript. Description: Used to sum two numbers. Syntax: result = expression1 + expression2. Note: Although you can also use the + operator to concatenate two character strings, you should use the Concatenation (&) operator for concatenation to eliminate ambiguity and provide self-documenting script. When you use the + operator, you may not be ...

  19. += Operator

    This assignment operator implicitly performs widening but not narrowing conversions if the compilation environment enforces strict semantics. For more information on these conversions, see Widening and Narrowing Conversions.For more information on strict and permissive semantics, see Option Strict Statement.. If permissive semantics are allowed, the += operator implicitly performs a variety of ...

  20. VB.Net

    Try the following example to understand all the assignment operators available in VB.Net −. Module assignment. Sub Main() Dim a As Integer = 21 Dim pow As Integer = 2 Dim str1 As String = "Hello! " Dim str2 As String = "VB Programmers" Dim c As Integer. c = a. Console.WriteLine("Line 1 - = Operator Example, _.

  21. What Is Assignment Operator Overloading?

    One of the most commonly used features of C++ software, in common with many programming languages, is the "=" assignment operator. These take the form of copy assignment and move assignment operators. In C++, we can overload the "=" assignment operator by creating a new assignment operator, this is called assignment operator overloading.

  22. Logical and Bitwise Operators

    See also. Logical operators compare Boolean expressions and return a Boolean result. The And, Or, AndAlso, OrElse, and Xor operators are binary because they take two operands, while the Not operator is unary because it takes a single operand. Some of these operators can also perform bitwise logical operations on integral values.

  23. C++ Programming/Operators/Operator Overloading

    Operator overloading [edit | edit source]. Operator overloading (less commonly known as ad-hoc polymorphism) is a specific case of polymorphism (part of the OO nature of the language) in which some or all operators like +, = or == are treated as polymorphic functions and as such have different behaviors depending on the types of its arguments. Operator overloading is usually only syntactic sugar.

  24. The Battle off Samar: The Sacrifice of "Taffy 3"

    USS Gambier Bay (CVE-73) and two destroyer escorts making smoke at the start of the battle off Samar, 25 October 1944. Japanese ships are faintly visible on the horizon beyond the smoke screen (80-G-288144). USS Heerman (DD-532) and a destroyer escort lay a smoke screen to protect Taffy 3 from attacking Japanese surface ships at the beginning ...

  25. Loader Operator Job in Richmond, VA

    Shirley Contracting Company, LLC is looking for RT and Track Loader Operators to join our dirt and utility crews. Qualifications: Experience running heavy equipment (an onsite try-out will be conducted) GPS/UTS experience, preferred. Work in outdoor environments in all seasons. Must pass pre-employment physical/drug screening.

  26. Traditional versus progressive robot-assisted gait training in people

    Gait disorders are the most frequent symptoms associated to multiple sclerosis (MS). Robot-assisted gait training (RAGT) in people with MS (PwMS) has been proposed as a possible effective treatment option for severe motor disability without significant superiority when compared to intensive overground gait training (OGT). Furthermore, RAGT at high intensity may enhance fatigue and spasticity ...

  27. Un ejemplo de uso elegante del operador "null coalescing assignment" de

    Revisando código ajeno, me he encontrado con un ejemplo de uso del operador null coalescing assignment de C# que me ha parecido muy elegante y quería compartirlo con vosotros.. Como recordaréis, este operador, introducido en C# 8, es una fórmula muy concisa para asignar un valor a una variable si ésta previamente es null, una mezcla entre el operador de asignación y el null coalescing ...