Questions tagged as 'constantes'

1
answer

What is the difference between const and readonly?

Constants and read-only fields can not be modified, as can be seen in the documentation:    const   Fields and constant places are not variables and can not be modified .    readonly   When a field declaration includes a rea...
asked by 08.09.2016 / 17:17
3
answers

Difference between PATH_SEPARATOR and DIRECTORY_SEPARATOR

The documentation on this is rather vague, the little that exists does not clearly clarify the difference between the use and purpose of the following two PHP constants: PATH_SEPARATOR and DIRECTORY_SEPARATOR At first glance, it seems...
asked by 22.01.2014 / 12:19
3
answers

Why is it possible to change an array or object value from within a constant?

const array = ["a", "b", "c", "d"]; array[1] = 2; console.log(array); //- ['a',2,'c','d'] In this example I gave, I changed the value of the constant dynamically, too, it is possible to do the same with objects. I would like to...
asked by 29.09.2018 / 01:17
3
answers

How to print a constant in the middle of a string, without concatenating?

Is there any way to print a constant in the middle of a string , without using concatenation, how do you do with variables in PHP? Example: $nome = 'wallace'; echo "Meu nome é {$nome}"; For constants, I know I could print concatenatin...
asked by 15.09.2015 / 22:53
2
answers

What are the advantages and disadvantages of declaring constants as an array?

I found this new feature a lot of way around PHP 5.6. It is now possible to set a array to the value of a constant. See how cool: const BR_DATES = [ 1 => 'Janeiro', 2 => 'Fevereiro', 3 => 'Março', 4 =>...
asked by 03.03.2015 / 15:06
1
answer

Because the practice of "constant parameter" only exists in C

In C, there is the practice of applying the modifier "const" to function parameters when the function is not intended to change the parameter. As in this code: char process_string(const char *str); Because in other languages there is no suc...
asked by 13.03.2014 / 08:04
3
answers

Set constant in Python

How can I declare a Python constant in the same way I do in C with #Define PI 3.1415 or in java public final double PI = 3.1415     
asked by 05.04.2017 / 21:35
2
answers

What is the difference between define () and const?

What is the difference between declaring constants with define() or with const . Would it be the same or are there any details that I should know about? define('TESTE', 'constante 1'); const TESTE2 = 'constante 2'; echo TEST...
asked by 04.01.2015 / 19:17
1
answer

How to declare constants in R

When I was playing the example of the " How to transform a string in Date format in R? " the command tab<-readHTMLTable(u,header=T,skip.rows=1) failed. The error happened because in my environment it is natural to assign the T val...
asked by 06.03.2014 / 15:46
3
answers

When to use const and when to use #define

Since the two do the same function is there any difference between one and the other? I'll take the code from this site as an example C - Constants & Literals The #define Preprocessor #include <stdio.h> #define LENGTH 10...
asked by 22.06.2016 / 15:51