Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about readonly-variable

Read more about readonly-variable

python (65.2k questions)

javascript (44.3k questions)

reactjs (22.7k questions)

java (20.8k questions)

c# (17.4k questions)

html (16.3k questions)

r (13.7k questions)

android (13k questions)

Questions - readonly-variable

Is there a way to mark a function as only called/callable from a static constructor?

I have quite a sizeable static constructor for one of my classes, and was wanting to refactor it to encapsulate various bits of the initialization within static functions. One of the things this stati...
test-img

fweaks

c#

static-methods

static-constructor

readonly-variable

Votes: 0

Answers: 2

Latest Answer

You can define local functions inside a static constructor; public class MyClass { public static readonly int Value; static MyClass(){ Value = Calc(1); return; ...
test-img

Jeremy Lakeman

What is the difference between `state` and `const`?

It seems similar to write: use Const::Fast; const $xx, 77; sub test { do_something_with( $xx ); } or sub test { state $xx = 77; do_something_with( $xx ); } What is the better wa...
test-img

Eugen Konkov

perl

readonly-variable

Votes: 0

Answers: 3

Latest Answer

They do not do the same thing. state declares a variable that will only be initialized the first time you enter the function. It's mutable though, so you can change its value, but it will keep the v...
test-img

Ted Lyngmo

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved