Getting Started with V Programming by Navule Pavan Kumar Rao

Getting Started with V Programming by Navule Pavan Kumar Rao

Author:Navule Pavan Kumar Rao [Rao, Navule Pavan Kumar]
Language: eng
Format: epub
Tags: Software development, Concurrent programming
Publisher: Packt Publishing
Published: 2021-12-10T00:00:00+00:00


You will notice that V will throw an error, as shown here:

error: field `Note.message` must be initialized

As we have marked the message field as [required], we must initialize the message field going forward. The full code, along with the message field being initialized, will appear as shown here:

module main pub struct Note { pub: id int pub mut: message string [required] status bool } fn main() { n := Note{ id: 1 message: 'a simple struct demo' status: false } println(n) }

Defining struct fields with default values



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.